move an `assert!` to the right place

This commit is contained in:
Waffle Maybe 2022-08-09 21:19:19 +04:00 committed by GitHub
parent a7c45ec867
commit d52ed8234e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1555,12 +1555,12 @@ impl<T: ?Sized> *mut T {
/// if offset < x.len() - 1 {
/// let u16_ptr = ptr.add(offset).cast::<u16>();
/// *u16_ptr = 0;
///
/// assert!(x == [0, 0, 7, 8, 9] || x == [5, 0, 0, 8, 9]);
/// } else {
/// // while the pointer can be aligned via `offset`, it would point
/// // outside the allocation
/// }
///
/// assert!(x == [0, 0, 7, 8, 9] || x == [5, 0, 0, 8, 9]);
/// # }
/// ```
#[stable(feature = "align_offset", since = "1.36.0")]