Skip to content

Commit 4de4d60

Browse files
committed
Auto merge of #105508 - eduardosm:ptr-methods-inline-always, r=Mark-Simulacrum
Make pointer `sub` and `wrapping_sub` methods `#[inline(always)]` Splitted from #105262
2 parents f34356e + 3ed058b commit 4de4d60

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

Diff for: library/core/src/ptr/const_ptr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1008,7 +1008,7 @@ impl<T: ?Sized> *const T {
10081008
#[stable(feature = "pointer_methods", since = "1.26.0")]
10091009
#[must_use = "returns a new pointer rather than modifying its argument"]
10101010
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
1011-
#[inline]
1011+
#[inline(always)]
10121012
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
10131013
pub const unsafe fn sub(self, count: usize) -> Self
10141014
where
@@ -1173,7 +1173,7 @@ impl<T: ?Sized> *const T {
11731173
#[stable(feature = "pointer_methods", since = "1.26.0")]
11741174
#[must_use = "returns a new pointer rather than modifying its argument"]
11751175
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
1176-
#[inline]
1176+
#[inline(always)]
11771177
pub const fn wrapping_sub(self, count: usize) -> Self
11781178
where
11791179
T: Sized,

Diff for: library/core/src/ptr/mut_ptr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1110,7 +1110,7 @@ impl<T: ?Sized> *mut T {
11101110
#[stable(feature = "pointer_methods", since = "1.26.0")]
11111111
#[must_use = "returns a new pointer rather than modifying its argument"]
11121112
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
1113-
#[inline]
1113+
#[inline(always)]
11141114
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
11151115
pub const unsafe fn sub(self, count: usize) -> Self
11161116
where
@@ -1275,7 +1275,7 @@ impl<T: ?Sized> *mut T {
12751275
#[stable(feature = "pointer_methods", since = "1.26.0")]
12761276
#[must_use = "returns a new pointer rather than modifying its argument"]
12771277
#[rustc_const_stable(feature = "const_ptr_offset", since = "1.61.0")]
1278-
#[inline]
1278+
#[inline(always)]
12791279
pub const fn wrapping_sub(self, count: usize) -> Self
12801280
where
12811281
T: Sized,

0 commit comments

Comments
 (0)