We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 978a553 commit 57c7b80Copy full SHA for 57c7b80
core/src/slice/mod.rs
@@ -4578,8 +4578,8 @@ impl<T> [T] {
4578
panic!("elements are zero-sized");
4579
}
4580
4581
- let self_start = self.as_ptr() as usize;
4582
- let elem_start = element as *const T as usize;
+ let self_start = self.as_ptr().addr();
+ let elem_start = ptr::from_ref(element).addr();
4583
4584
let byte_offset = elem_start.wrapping_sub(self_start);
4585
@@ -4631,8 +4631,8 @@ impl<T> [T] {
4631
4632
4633
4634
4635
- let subslice_start = subslice.as_ptr() as usize;
+ let subslice_start = subslice.as_ptr().addr();
4636
4637
let byte_start = subslice_start.wrapping_sub(self_start);
4638
0 commit comments