Skip to content

Commit d70afd5

Browse files
committed
Stabilize [const_]pointer_byte_offsets
1 parent d4589a4 commit d70afd5

File tree

9 files changed

+42
-42
lines changed

9 files changed

+42
-42
lines changed

compiler/rustc_arena/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#![feature(maybe_uninit_slice)]
1818
#![feature(min_specialization)]
1919
#![feature(decl_macro)]
20-
#![feature(pointer_byte_offsets)]
2120
#![feature(rustc_attrs)]
2221
#![cfg_attr(test, feature(test))]
2322
#![feature(strict_provenance)]

library/alloc/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,6 @@
139139
#![feature(maybe_uninit_uninit_array)]
140140
#![feature(maybe_uninit_uninit_array_transpose)]
141141
#![feature(pattern)]
142-
#![feature(pointer_byte_offsets)]
143142
#![feature(ptr_internals)]
144143
#![feature(ptr_metadata)]
145144
#![feature(ptr_sub_ptr)]

library/core/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@
149149
#![feature(const_option)]
150150
#![feature(const_option_ext)]
151151
#![feature(const_pin)]
152-
#![feature(const_pointer_byte_offsets)]
153152
#![feature(const_pointer_is_aligned)]
154153
#![feature(const_ptr_as_ref)]
155154
#![feature(const_ptr_is_null)]

library/core/src/ptr/const_ptr.rs

+21-16
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,9 @@ impl<T: ?Sized> *const T {
480480
/// leaving the metadata untouched.
481481
#[must_use]
482482
#[inline(always)]
483-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
484-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
483+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
484+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
485+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
485486
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
486487
pub const unsafe fn byte_offset(self, count: isize) -> Self {
487488
// SAFETY: the caller must uphold the safety contract for `offset`.
@@ -560,8 +561,9 @@ impl<T: ?Sized> *const T {
560561
/// leaving the metadata untouched.
561562
#[must_use]
562563
#[inline(always)]
563-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
564-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
564+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
565+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
566+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
565567
pub const fn wrapping_byte_offset(self, count: isize) -> Self {
566568
self.cast::<u8>().wrapping_offset(count).with_metadata_of(self)
567569
}
@@ -709,8 +711,9 @@ impl<T: ?Sized> *const T {
709711
/// For non-`Sized` pointees this operation considers only the data pointers,
710712
/// ignoring the metadata.
711713
#[inline(always)]
712-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
713-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
714+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
715+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
716+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
714717
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
715718
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: *const U) -> isize {
716719
// SAFETY: the caller must uphold the safety contract for `offset_from`.
@@ -935,8 +938,9 @@ impl<T: ?Sized> *const T {
935938
/// leaving the metadata untouched.
936939
#[must_use]
937940
#[inline(always)]
938-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
939-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
941+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
942+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
943+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
940944
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
941945
pub const unsafe fn byte_add(self, count: usize) -> Self {
942946
// SAFETY: the caller must uphold the safety contract for `add`.
@@ -1028,8 +1032,9 @@ impl<T: ?Sized> *const T {
10281032
/// leaving the metadata untouched.
10291033
#[must_use]
10301034
#[inline(always)]
1031-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
1032-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
1035+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1036+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1037+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
10331038
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
10341039
pub const unsafe fn byte_sub(self, count: usize) -> Self {
10351040
// SAFETY: the caller must uphold the safety contract for `sub`.
@@ -1108,8 +1113,9 @@ impl<T: ?Sized> *const T {
11081113
/// leaving the metadata untouched.
11091114
#[must_use]
11101115
#[inline(always)]
1111-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
1112-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
1116+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1117+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1118+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
11131119
pub const fn wrapping_byte_add(self, count: usize) -> Self {
11141120
self.cast::<u8>().wrapping_add(count).with_metadata_of(self)
11151121
}
@@ -1186,8 +1192,9 @@ impl<T: ?Sized> *const T {
11861192
/// leaving the metadata untouched.
11871193
#[must_use]
11881194
#[inline(always)]
1189-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
1190-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
1195+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1196+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1197+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
11911198
pub const fn wrapping_byte_sub(self, count: usize) -> Self {
11921199
self.cast::<u8>().wrapping_sub(count).with_metadata_of(self)
11931200
}
@@ -1355,7 +1362,6 @@ impl<T: ?Sized> *const T {
13551362
///
13561363
/// ```
13571364
/// #![feature(pointer_is_aligned)]
1358-
/// #![feature(pointer_byte_offsets)]
13591365
///
13601366
/// // On some platforms, the alignment of i32 is less than 4.
13611367
/// #[repr(align(4))]
@@ -1477,7 +1483,6 @@ impl<T: ?Sized> *const T {
14771483
///
14781484
/// ```
14791485
/// #![feature(pointer_is_aligned)]
1480-
/// #![feature(pointer_byte_offsets)]
14811486
///
14821487
/// // On some platforms, the alignment of i32 is less than 4.
14831488
/// #[repr(align(4))]

library/core/src/ptr/mut_ptr.rs

+21-16
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,9 @@ impl<T: ?Sized> *mut T {
495495
/// leaving the metadata untouched.
496496
#[must_use]
497497
#[inline(always)]
498-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
499-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
498+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
499+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
500+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
500501
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
501502
pub const unsafe fn byte_offset(self, count: isize) -> Self {
502503
// SAFETY: the caller must uphold the safety contract for `offset`.
@@ -574,8 +575,9 @@ impl<T: ?Sized> *mut T {
574575
/// leaving the metadata untouched.
575576
#[must_use]
576577
#[inline(always)]
577-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
578-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
578+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
579+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
580+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
579581
pub const fn wrapping_byte_offset(self, count: isize) -> Self {
580582
self.cast::<u8>().wrapping_offset(count).with_metadata_of(self)
581583
}
@@ -881,8 +883,9 @@ impl<T: ?Sized> *mut T {
881883
/// For non-`Sized` pointees this operation considers only the data pointers,
882884
/// ignoring the metadata.
883885
#[inline(always)]
884-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
885-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
886+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
887+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
888+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
886889
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
887890
pub const unsafe fn byte_offset_from<U: ?Sized>(self, origin: *const U) -> isize {
888891
// SAFETY: the caller must uphold the safety contract for `offset_from`.
@@ -1036,8 +1039,9 @@ impl<T: ?Sized> *mut T {
10361039
/// leaving the metadata untouched.
10371040
#[must_use]
10381041
#[inline(always)]
1039-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
1040-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
1042+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1043+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1044+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
10411045
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
10421046
pub const unsafe fn byte_add(self, count: usize) -> Self {
10431047
// SAFETY: the caller must uphold the safety contract for `add`.
@@ -1129,8 +1133,9 @@ impl<T: ?Sized> *mut T {
11291133
/// leaving the metadata untouched.
11301134
#[must_use]
11311135
#[inline(always)]
1132-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
1133-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
1136+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1137+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1138+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
11341139
#[cfg_attr(miri, track_caller)] // even without panics, this helps for Miri backtraces
11351140
pub const unsafe fn byte_sub(self, count: usize) -> Self {
11361141
// SAFETY: the caller must uphold the safety contract for `sub`.
@@ -1209,8 +1214,9 @@ impl<T: ?Sized> *mut T {
12091214
/// leaving the metadata untouched.
12101215
#[must_use]
12111216
#[inline(always)]
1212-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
1213-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
1217+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1218+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1219+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
12141220
pub const fn wrapping_byte_add(self, count: usize) -> Self {
12151221
self.cast::<u8>().wrapping_add(count).with_metadata_of(self)
12161222
}
@@ -1287,8 +1293,9 @@ impl<T: ?Sized> *mut T {
12871293
/// leaving the metadata untouched.
12881294
#[must_use]
12891295
#[inline(always)]
1290-
#[unstable(feature = "pointer_byte_offsets", issue = "96283")]
1291-
#[rustc_const_unstable(feature = "const_pointer_byte_offsets", issue = "96283")]
1296+
#[stable(feature = "pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1297+
#[rustc_const_stable(feature = "const_pointer_byte_offsets", since = "CURRENT_RUSTC_VERSION")]
1298+
#[rustc_allow_const_fn_unstable(set_ptr_value)]
12921299
pub const fn wrapping_byte_sub(self, count: usize) -> Self {
12931300
self.cast::<u8>().wrapping_sub(count).with_metadata_of(self)
12941301
}
@@ -1622,7 +1629,6 @@ impl<T: ?Sized> *mut T {
16221629
///
16231630
/// ```
16241631
/// #![feature(pointer_is_aligned)]
1625-
/// #![feature(pointer_byte_offsets)]
16261632
///
16271633
/// // On some platforms, the alignment of i32 is less than 4.
16281634
/// #[repr(align(4))]
@@ -1746,7 +1752,6 @@ impl<T: ?Sized> *mut T {
17461752
///
17471753
/// ```
17481754
/// #![feature(pointer_is_aligned)]
1749-
/// #![feature(pointer_byte_offsets)]
17501755
///
17511756
/// // On some platforms, the alignment of i32 is less than 4.
17521757
/// #[repr(align(4))]

library/core/tests/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
#![feature(const_maybe_uninit_as_mut_ptr)]
1818
#![feature(const_maybe_uninit_assume_init_read)]
1919
#![feature(const_nonnull_new)]
20-
#![feature(const_pointer_byte_offsets)]
2120
#![feature(const_pointer_is_aligned)]
2221
#![feature(const_ptr_as_ref)]
2322
#![feature(const_ptr_write)]
@@ -86,7 +85,6 @@
8685
#![feature(const_waker)]
8786
#![feature(never_type)]
8887
#![feature(unwrap_infallible)]
89-
#![feature(pointer_byte_offsets)]
9088
#![feature(pointer_is_aligned)]
9189
#![feature(portable_simd)]
9290
#![feature(ptr_metadata)]

library/std/src/lib.rs

-1
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,6 @@
328328
#![feature(panic_can_unwind)]
329329
#![feature(panic_info_message)]
330330
#![feature(panic_internals)]
331-
#![feature(pointer_byte_offsets)]
332331
#![feature(pointer_is_aligned)]
333332
#![feature(portable_simd)]
334333
#![feature(prelude_2024)]

tests/ui/const-ptr/allowed_slices.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
#![feature(
33
slice_from_ptr_range,
44
const_slice_from_ptr_range,
5-
pointer_byte_offsets,
6-
const_pointer_byte_offsets
75
)]
86
use std::{
97
mem::MaybeUninit,

tests/ui/const-ptr/forbidden_slices.rs

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
#![feature(
77
slice_from_ptr_range,
88
const_slice_from_ptr_range,
9-
pointer_byte_offsets,
10-
const_pointer_byte_offsets
119
)]
1210
use std::{
1311
mem::{size_of, MaybeUninit},

0 commit comments

Comments
 (0)