Skip to content

Commit ee21454

Browse files
committed
attempt to clarify align_to docs
1 parent fd02567 commit ee21454

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

library/core/src/slice/mod.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -3468,10 +3468,11 @@ impl<T> [T] {
34683468
/// maintained.
34693469
///
34703470
/// This method splits the slice into three distinct slices: prefix, correctly aligned middle
3471-
/// slice of a new type, and the suffix slice. The method may make the middle slice the greatest
3472-
/// length possible for a given type and input slice, but only your algorithm's performance
3473-
/// should depend on that, not its correctness. It is permissible for all of the input data to
3474-
/// be returned as the prefix or suffix slice.
3471+
/// slice of a new type, and the suffix slice. How exactly the slice is split up is not
3472+
/// specified; the middle part may be smaller than necessary. However, if this fails to return a
3473+
/// maximal middle part, that is because code is running in a context where performance does not
3474+
/// matter, such as a sanitizer attempting to find alignment bugs. Regular code running
3475+
/// in a default (debug or release) execution *will* return a maximal middle part.
34753476
///
34763477
/// This method has no purpose when either input element `T` or output element `U` are
34773478
/// zero-sized and will return the original slice without splitting anything.
@@ -3529,10 +3530,11 @@ impl<T> [T] {
35293530
/// types is maintained.
35303531
///
35313532
/// This method splits the slice into three distinct slices: prefix, correctly aligned middle
3532-
/// slice of a new type, and the suffix slice. The method may make the middle slice the greatest
3533-
/// length possible for a given type and input slice, but only your algorithm's performance
3534-
/// should depend on that, not its correctness. It is permissible for all of the input data to
3535-
/// be returned as the prefix or suffix slice.
3533+
/// slice of a new type, and the suffix slice. How exactly the slice is split up is not
3534+
/// specified; the middle part may be smaller than necessary. However, if this fails to return a
3535+
/// maximal middle part, that is because code is running in a context where performance does not
3536+
/// matter, such as a sanitizer attempting to find alignment bugs. Regular code running
3537+
/// in a default (debug or release) execution *will* return a maximal middle part.
35363538
///
35373539
/// This method has no purpose when either input element `T` or output element `U` are
35383540
/// zero-sized and will return the original slice without splitting anything.

0 commit comments

Comments
 (0)