Skip to content

Commit f86db5e

Browse files
committed
Auto merge of #111447 - scottmcm:remove-more-assumes, r=thomcc
Remove useless `assume`s from `slice::iter(_mut)` You were right in rust-lang/rust#111395 (comment), r? `@the8472` LLVM already removes these assumes while optimizing, as can be seen in <https://rust.godbolt.org/z/KTfWKbdEM>.
2 parents 971ef73 + f032a84 commit f86db5e

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

core/src/slice/iter.rs

-4
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,6 @@ impl<'a, T> Iter<'a, T> {
9090
let ptr = slice.as_ptr();
9191
// SAFETY: Similar to `IterMut::new`.
9292
unsafe {
93-
assume(!ptr.is_null());
94-
9593
let end = if T::IS_ZST { invalid(slice.len()) } else { ptr.add(slice.len()) };
9694

9795
Self { ptr: NonNull::new_unchecked(ptr as *mut T), end, _marker: PhantomData }
@@ -228,8 +226,6 @@ impl<'a, T> IterMut<'a, T> {
228226
// See the `next_unchecked!` and `is_empty!` macros as well as the
229227
// `post_inc_start` method for more information.
230228
unsafe {
231-
assume(!ptr.is_null());
232-
233229
let end = if T::IS_ZST { invalid_mut(slice.len()) } else { ptr.add(slice.len()) };
234230

235231
Self { ptr: NonNull::new_unchecked(ptr), end, _marker: PhantomData }

0 commit comments

Comments
 (0)