From d52ed8234e8a9b8f3b988b63dae44e82827fcbda Mon Sep 17 00:00:00 2001 From: Waffle Maybe Date: Tue, 9 Aug 2022 21:19:19 +0400 Subject: [PATCH] move an `assert!` to the right place --- library/core/src/ptr/mut_ptr.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs index b8551eeed9e0d..bd2cadef7742e 100644 --- a/library/core/src/ptr/mut_ptr.rs +++ b/library/core/src/ptr/mut_ptr.rs @@ -1555,12 +1555,12 @@ impl *mut T { /// if offset < x.len() - 1 { /// let u16_ptr = ptr.add(offset).cast::(); /// *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")]