We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f9afc04 commit 7babfc5Copy full SHA for 7babfc5
library/core/src/slice/iter/macros.rs
@@ -482,16 +482,13 @@ macro_rules! iterator {
482
return func(None);
483
}
484
} else {
485
- // SAFETY: by type invariant, the `end_or_len` field is always
486
- // non-null for a non-ZST pointee. (This transmute ensures we
487
- // get `!nonnull` metadata on the load of the field.)
488
- if ptr == crate::intrinsics::transmute::<$ptr, NonNull<T>>(end_or_len) {
+ if ptr.as_ptr() == end_or_len {
489
490
491
492
// SAFETY: Now that we know it wasn't empty
493
// we can give out a reference to it.
494
- let tmp = {ptr}.$into_ref();
+ let tmp = ptr.$into_ref();
495
func(Some(&tmp))
496
497
0 commit comments