summaryrefslogtreecommitdiffstats
path: root/library/core/src/ptr/mut_ptr.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-07 05:48:48 +0000
commitef24de24a82fe681581cc130f342363c47c0969a (patch)
tree0d494f7e1a38b95c92426f58fe6eaa877303a86c /library/core/src/ptr/mut_ptr.rs
parentReleasing progress-linux version 1.74.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-ef24de24a82fe681581cc130f342363c47c0969a.tar.xz
rustc-ef24de24a82fe681581cc130f342363c47c0969a.zip
Merging upstream version 1.75.0+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'library/core/src/ptr/mut_ptr.rs')
-rw-r--r--library/core/src/ptr/mut_ptr.rs37
1 files changed, 21 insertions, 16 deletions
diff --git a/library/core/src/ptr/mut_ptr.rs b/library/core/src/ptr/mut_ptr.rs
index 109c28692..bc362fb62 100644
--- a/library/core/src/ptr/mut_ptr.rs
+++ b/library/core/src/ptr/mut_ptr.rs
@@ -495,8 +495,9 @@ impl<T: ?Sized> *mut T {
/// leaving the metadata untouched.
#[must_use]
#[inline(always)]
- #[unstable(feature = "pointer_byte_offsets", issue = "96283")]
- #[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
+ #[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_allow_const_fn_unstable(set_ptr_value)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn byte_offset(self, count: isize) -> Self {
// SAFETY: the caller must uphold the safety contract for `offset`.
@@ -574,8 +575,9 @@ impl<T: ?Sized> *mut T {
/// leaving the metadata untouched.
#[must_use]
#[inline(always)]
- #[unstable(feature = "pointer_byte_offsets", issue = "96283")]
- #[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
+ #[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_allow_const_fn_unstable(set_ptr_value)]
pub const fn wrapping_byte_offset(self, count: isize) -> Self {
self.cast::<u8>().wrapping_offset(count).with_metadata_of(self)
}
@@ -898,8 +900,9 @@ impl<T: ?Sized> *mut T {
/// For non-`Sized` pointees this operation considers only the data pointers,
/// ignoring the metadata.
#[inline(always)]
- #[unstable(feature = "pointer_byte_offsets", issue = "96283")]
- #[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
+ #[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_allow_const_fn_unstable(set_ptr_value)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: *const U) -> isize {
// SAFETY: the caller must uphold the safety contract for `offset_from`.
@@ -1053,8 +1056,9 @@ impl<T: ?Sized> *mut T {
/// leaving the metadata untouched.
#[must_use]
#[inline(always)]
- #[unstable(feature = "pointer_byte_offsets", issue = "96283")]
- #[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
+ #[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_allow_const_fn_unstable(set_ptr_value)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn byte_add(self, count: usize) -> Self {
// SAFETY: the caller must uphold the safety contract for `add`.
@@ -1146,8 +1150,9 @@ impl<T: ?Sized> *mut T {
/// leaving the metadata untouched.
#[must_use]
#[inline(always)]
- #[unstable(feature = "pointer_byte_offsets", issue = "96283")]
- #[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
+ #[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_allow_const_fn_unstable(set_ptr_value)]
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
pub const unsafe fn byte_sub(self, count: usize) -> Self {
// SAFETY: the caller must uphold the safety contract for `sub`.
@@ -1226,8 +1231,9 @@ impl<T: ?Sized> *mut T {
/// leaving the metadata untouched.
#[must_use]
#[inline(always)]
- #[unstable(feature = "pointer_byte_offsets", issue = "96283")]
- #[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
+ #[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_allow_const_fn_unstable(set_ptr_value)]
pub const fn wrapping_byte_add(self, count: usize) -> Self {
self.cast::<u8>().wrapping_add(count).with_metadata_of(self)
}
@@ -1304,8 +1310,9 @@ impl<T: ?Sized> *mut T {
/// leaving the metadata untouched.
#[must_use]
#[inline(always)]
- #[unstable(feature = "pointer_byte_offsets", issue = "96283")]
- #[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
+ #[stable(feature = "pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "1.75.0")]
+ #[rustc_allow_const_fn_unstable(set_ptr_value)]
pub const fn wrapping_byte_sub(self, count: usize) -> Self {
self.cast::<u8>().wrapping_sub(count).with_metadata_of(self)
}
@@ -1639,7 +1646,6 @@ impl<T: ?Sized> *mut T {
///
/// ```
/// #![feature(pointer_is_aligned)]
- /// #![feature(pointer_byte_offsets)]
///
/// // On some platforms, the alignment of i32 is less than 4.
/// #[repr(align(4))]
@@ -1763,7 +1769,6 @@ impl<T: ?Sized> *mut T {
///
/// ```
/// #![feature(pointer_is_aligned)]
- /// #![feature(pointer_byte_offsets)]
///
/// // On some platforms, the alignment of i32 is less than 4.
/// #[repr(align(4))]