diff --git a/library/core/src/ptr/const_ptr.rs b/library/core/src/ptr/const_ptr.rs index 87e2f0db25a76..295fd538d8cfd 100644 --- a/library/core/src/ptr/const_ptr.rs +++ b/library/core/src/ptr/const_ptr.rs @@ -611,7 +611,7 @@ impl *const T { /// ``` #[stable(feature = "ptr_offset_from", since = "1.47.0")] #[rustc_const_stable(feature = "const_ptr_offset_from", since = "1.65.0")] - #[inline] + #[inline(always)] #[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces pub const unsafe fn offset_from(self, origin: *const T) -> isize where @@ -1142,7 +1142,7 @@ impl *const T { /// [`ptr::read`]: crate::ptr::read() #[stable(feature = "pointer_methods", since = "1.26.0")] #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")] - #[inline] + #[inline(always)] #[track_caller] pub const unsafe fn read(self) -> T where @@ -1164,7 +1164,7 @@ impl *const T { /// [`ptr::read_volatile`]: crate::ptr::read_volatile() #[stable(feature = "pointer_methods", since = "1.26.0")] #[rustc_const_unstable(feature = "const_volatile", issue = "159094")] - #[inline] + #[inline(always)] #[track_caller] pub const unsafe fn read_volatile(self) -> T where @@ -1184,7 +1184,7 @@ impl *const T { /// [`ptr::read_unaligned`]: crate::ptr::read_unaligned() #[stable(feature = "pointer_methods", since = "1.26.0")] #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")] - #[inline] + #[inline(always)] #[track_caller] pub const unsafe fn read_unaligned(self) -> T where @@ -1204,7 +1204,7 @@ impl *const T { /// [`ptr::copy`]: crate::ptr::copy() #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")] #[stable(feature = "pointer_methods", since = "1.26.0")] - #[inline] + #[inline(always)] #[track_caller] pub const unsafe fn copy_to(self, dest: *mut T, count: usize) where @@ -1224,7 +1224,7 @@ impl *const T { /// [`ptr::copy_nonoverlapping`]: crate::ptr::copy_nonoverlapping() #[rustc_const_stable(feature = "const_intrinsic_copy", since = "1.83.0")] #[stable(feature = "pointer_methods", since = "1.26.0")] - #[inline] + #[inline(always)] #[track_caller] pub const unsafe fn copy_to_nonoverlapping(self, dest: *mut T, count: usize) where @@ -1435,7 +1435,7 @@ impl *const [T] { /// let slice: *const [i8] = ptr::slice_from_raw_parts(ptr::null(), 3); /// assert_eq!(slice.len(), 3); /// ``` - #[inline] + #[inline(always)] #[stable(feature = "slice_ptr_len", since = "1.79.0")] #[rustc_const_stable(feature = "const_slice_ptr_len", since = "1.79.0")] pub const fn len(self) -> usize { @@ -1472,7 +1472,7 @@ impl *const [T] { /// let slice: *const [i8] = ptr::slice_from_raw_parts(ptr::null(), 3); /// assert_eq!(slice.as_ptr(), ptr::null()); /// ``` - #[inline] + #[inline(always)] #[unstable(feature = "slice_ptr_get", issue = "74265")] pub const fn as_ptr(self) -> *const T { self as *const T @@ -1516,7 +1516,7 @@ impl *const [T] { /// ``` #[unstable(feature = "slice_ptr_get", issue = "74265")] #[rustc_const_unstable(feature = "const_index", issue = "143775")] - #[inline] + #[inline(always)] pub const unsafe fn get_unchecked(self, index: I) -> *const I::Output where I: [const] SliceIndex<[T]>, @@ -1561,7 +1561,7 @@ impl *const [T; N] { /// let arr: *const [i8; 3] = ptr::null(); /// assert_eq!(arr.as_ptr(), ptr::null()); /// ``` - #[inline] + #[inline(always)] #[unstable(feature = "array_ptr_get", issue = "119834")] pub const fn as_ptr(self) -> *const T { self as *const T @@ -1592,7 +1592,7 @@ impl *const [T; N] { note = "see issue #53020 for more information" )] impl PartialEq for *const T { - #[inline] + #[inline(always)] #[allow(ambiguous_wide_pointer_comparisons)] fn eq(&self, other: &*const T) -> bool { *self == *other @@ -1634,31 +1634,31 @@ impl Ord for *const T { note = "see issue #53020 for more information" )] impl PartialOrd for *const T { - #[inline] + #[inline(always)] #[allow(ambiguous_wide_pointer_comparisons)] fn partial_cmp(&self, other: &*const T) -> Option { Some(self.cmp(other)) } - #[inline] + #[inline(always)] #[allow(ambiguous_wide_pointer_comparisons)] fn lt(&self, other: &*const T) -> bool { *self < *other } - #[inline] + #[inline(always)] #[allow(ambiguous_wide_pointer_comparisons)] fn le(&self, other: &*const T) -> bool { *self <= *other } - #[inline] + #[inline(always)] #[allow(ambiguous_wide_pointer_comparisons)] fn gt(&self, other: &*const T) -> bool { *self > *other } - #[inline] + #[inline(always)] #[allow(ambiguous_wide_pointer_comparisons)] fn ge(&self, other: &*const T) -> bool { *self >= *other diff --git a/library/core/src/ptr/mod.rs b/library/core/src/ptr/mod.rs index 41f4b837efaea..8b8a65d630189 100644 --- a/library/core/src/ptr/mod.rs +++ b/library/core/src/ptr/mod.rs @@ -1331,7 +1331,7 @@ pub const fn slice_from_raw_parts_mut(data: *mut T, len: usize) -> *mut [T] { /// assert_eq!([1, 0, 1, 2], array); /// } /// ``` -#[inline] +#[inline(always)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_swap", since = "1.85.0")] #[rustc_diagnostic_item = "ptr_swap"] @@ -1573,7 +1573,7 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, bytes: NonZero(dst: *mut T, src: T) -> T { /// ``` /// /// [valid]: self#safety -#[inline] +#[inline(always)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")] #[track_caller] @@ -1826,7 +1826,7 @@ pub const unsafe fn read(src: *const T) -> T { /// unsafe { ptr.read_unaligned() } /// } /// ``` -#[inline] +#[inline(always)] #[stable(feature = "ptr_unaligned", since = "1.17.0")] #[rustc_const_stable(feature = "const_ptr_read", since = "1.71.0")] #[track_caller] @@ -1932,7 +1932,7 @@ pub const unsafe fn read_unaligned(src: *const T) -> T { /// assert_eq!(foo, "bar"); /// assert_eq!(bar, "foo"); /// ``` -#[inline] +#[inline(always)] #[stable(feature = "rust1", since = "1.0.0")] #[rustc_const_stable(feature = "const_ptr_write", since = "1.83.0")] #[rustc_diagnostic_item = "ptr_write"] @@ -2036,7 +2036,7 @@ pub const unsafe fn write(dst: *mut T, src: T) { /// unsafe { ptr.write_unaligned(val) } /// } /// ``` -#[inline] +#[inline(always)] #[stable(feature = "ptr_unaligned", since = "1.17.0")] #[rustc_const_stable(feature = "const_ptr_write", since = "1.83.0")] #[rustc_diagnostic_item = "ptr_write_unaligned"] @@ -2141,7 +2141,7 @@ pub const unsafe fn write_unaligned(dst: *mut T, src: T) { /// assert_eq!(std::ptr::read_volatile(y), 12); /// } /// ``` -#[inline] +#[inline(always)] #[stable(feature = "volatile", since = "1.9.0")] #[rustc_const_unstable(feature = "const_volatile", issue = "159094")] #[track_caller] @@ -2247,7 +2247,7 @@ pub const unsafe fn read_volatile(src: *const T) -> T { /// assert_eq!(std::ptr::read_volatile(y), 12); /// } /// ``` -#[inline] +#[inline(always)] #[stable(feature = "volatile", since = "1.9.0")] #[rustc_const_unstable(feature = "const_volatile", issue = "159094")] #[rustc_diagnostic_item = "ptr_write_volatile"]