Also use mir::Offset
for pointer add
This commit is contained in:
parent
8bcfc0e597
commit
e1da77c76d
11 changed files with 117 additions and 77 deletions
|
@ -916,8 +916,16 @@ impl<T: ?Sized> *const T {
|
|||
where
|
||||
T: Sized,
|
||||
{
|
||||
#[cfg(bootstrap)]
|
||||
// SAFETY: the caller must uphold the safety contract for `offset`.
|
||||
unsafe { self.offset(count as isize) }
|
||||
unsafe {
|
||||
self.offset(count as isize)
|
||||
}
|
||||
#[cfg(not(bootstrap))]
|
||||
// SAFETY: the caller must uphold the safety contract for `offset`.
|
||||
unsafe {
|
||||
intrinsics::offset(self, count)
|
||||
}
|
||||
}
|
||||
|
||||
/// Calculates the offset from a pointer in bytes (convenience for `.byte_offset(count as isize)`).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue