Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 16 additions & 16 deletions library/core/src/ptr/const_ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ impl<T: PointeeSized> *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
Expand Down Expand Up @@ -1142,7 +1142,7 @@ impl<T: PointeeSized> *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
Expand All @@ -1164,7 +1164,7 @@ impl<T: PointeeSized> *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
Expand All @@ -1184,7 +1184,7 @@ impl<T: PointeeSized> *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
Expand All @@ -1204,7 +1204,7 @@ impl<T: PointeeSized> *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
Expand All @@ -1224,7 +1224,7 @@ impl<T: PointeeSized> *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
Expand Down Expand Up @@ -1435,7 +1435,7 @@ impl<T> *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 {
Expand Down Expand Up @@ -1472,7 +1472,7 @@ impl<T> *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
Expand Down Expand Up @@ -1516,7 +1516,7 @@ impl<T> *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<I>(self, index: I) -> *const I::Output
where
I: [const] SliceIndex<[T]>,
Expand Down Expand Up @@ -1561,7 +1561,7 @@ impl<T, const N: usize> *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
Expand Down Expand Up @@ -1592,7 +1592,7 @@ impl<T, const N: usize> *const [T; N] {
note = "see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information"
)]
impl<T: PointeeSized> PartialEq for *const T {
#[inline]
#[inline(always)]
#[allow(ambiguous_wide_pointer_comparisons)]
fn eq(&self, other: &*const T) -> bool {
*self == *other
Expand Down Expand Up @@ -1634,31 +1634,31 @@ impl<T: PointeeSized> Ord for *const T {
note = "see issue #53020 <https://github.com/rust-lang/rust/issues/53020> for more information"
)]
impl<T: PointeeSized> PartialOrd for *const T {
#[inline]
#[inline(always)]
#[allow(ambiguous_wide_pointer_comparisons)]
fn partial_cmp(&self, other: &*const T) -> Option<Ordering> {
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
Expand Down
16 changes: 8 additions & 8 deletions library/core/src/ptr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,7 @@ pub const fn slice_from_raw_parts_mut<T>(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"]
Expand Down Expand Up @@ -1573,7 +1573,7 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, bytes: NonZero<usize
/// assert_eq!(b, 'b');
/// assert_eq!(rust, &['r', 'u', 's', 't']);
/// ```
#[inline]
#[inline(always)]
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_const_stable(feature = "const_replace", since = "1.83.0")]
#[rustc_diagnostic_item = "ptr_replace"]
Expand Down Expand Up @@ -1708,7 +1708,7 @@ pub const unsafe fn replace<T>(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]
Expand Down Expand Up @@ -1826,7 +1826,7 @@ pub const unsafe fn read<T>(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]
Expand Down Expand Up @@ -1932,7 +1932,7 @@ pub const unsafe fn read_unaligned<T>(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"]
Expand Down Expand Up @@ -2036,7 +2036,7 @@ pub const unsafe fn write<T>(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"]
Expand Down Expand Up @@ -2141,7 +2141,7 @@ pub const unsafe fn write_unaligned<T>(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]
Expand Down Expand Up @@ -2247,7 +2247,7 @@ pub const unsafe fn read_volatile<T>(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"]
Expand Down
Loading