Skip to content

Commit

Permalink
Auto merge of rust-lang#105508 - eduardosm:ptr-methods-inline-always,…
Browse files Browse the repository at this point in the history
… r=Mark-Simulacrum

Make pointer `sub` and `wrapping_sub` methods `#[inline(always)]`

Splitted from rust-lang#105262
  • Loading branch information
bors committed Dec 11, 2022
2 parents f34356e + 3ed058b commit 4de4d60
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1008,7 +1008,7 @@ impl<T: ?Sized> *const T {
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
#[inline]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn sub(self, count: usize) -> Self
where
Expand Down Expand Up @@ -1173,7 +1173,7 @@ impl<T: ?Sized> *const T {
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
#[inline]
#[inline(always)]
pub const fn wrapping_sub(self, count: usize) -> Self
where
T: Sized,
Expand Down
4 changes: 2 additions & 2 deletions library/core/src/ptr/mut_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1110,7 +1110,7 @@ impl<T: ?Sized> *mut T {
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
#[inline]
#[inline(always)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn sub(self, count: usize) -> Self
where
Expand Down Expand Up @@ -1275,7 +1275,7 @@ impl<T: ?Sized> *mut T {
#[stable(feature = "pointer_methods", since = "1.26.0")]
#[must_use = "returns a new pointer rather than modifying its argument"]
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
#[inline]
#[inline(always)]
pub const fn wrapping_sub(self, count: usize) -> Self
where
T: Sized,
Expand Down

0 comments on commit 4de4d60

Please sign in to comment.