1
Fork 0

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

View file

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