Skip to content

Commit 3a33922

Browse files
authored
Rollup merge of rust-lang#129416 - workingjubilee:partial-move-from-stabilization, r=dtolnay
library: Move unstable API of new_uninit to new features - `new_zeroed` variants move to `new_zeroed_alloc` - the `write` fn moves to `box_uninit_write` The remainder will be stabilized in upcoming patches, as it was decided to only stabilize `uninit*` and `assume_init`.
2 parents 3a8de95 + 82fc74f commit 3a33922

File tree

4 files changed

+17
-9
lines changed

4 files changed

+17
-9
lines changed

Diff for: alloc/src/boxed.rs

+6-3
Original file line numberDiff line numberDiff line change
@@ -293,6 +293,7 @@ impl<T> Box<T> {
293293
///
294294
/// ```
295295
/// #![feature(new_uninit)]
296+
/// #![feature(new_zeroed_alloc)]
296297
///
297298
/// let zero = Box::<u32>::new_zeroed();
298299
/// let zero = unsafe { zero.assume_init() };
@@ -303,7 +304,7 @@ impl<T> Box<T> {
303304
/// [zeroed]: mem::MaybeUninit::zeroed
304305
#[cfg(not(no_global_oom_handling))]
305306
#[inline]
306-
#[unstable(feature = "new_uninit", issue = "63291")]
307+
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
307308
#[must_use]
308309
pub fn new_zeroed() -> Box<mem::MaybeUninit<T>> {
309310
Self::new_zeroed_in(Global)
@@ -684,6 +685,7 @@ impl<T> Box<[T]> {
684685
/// # Examples
685686
///
686687
/// ```
688+
/// #![feature(new_zeroed_alloc)]
687689
/// #![feature(new_uninit)]
688690
///
689691
/// let values = Box::<[u32]>::new_zeroed_slice(3);
@@ -694,7 +696,7 @@ impl<T> Box<[T]> {
694696
///
695697
/// [zeroed]: mem::MaybeUninit::zeroed
696698
#[cfg(not(no_global_oom_handling))]
697-
#[unstable(feature = "new_uninit", issue = "63291")]
699+
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
698700
#[must_use]
699701
pub fn new_zeroed_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> {
700702
unsafe { RawVec::with_capacity_zeroed(len).into_box(len) }
@@ -955,6 +957,7 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
955957
/// # Examples
956958
///
957959
/// ```
960+
/// #![feature(box_uninit_write)]
958961
/// #![feature(new_uninit)]
959962
///
960963
/// let big_box = Box::<[usize; 1024]>::new_uninit();
@@ -972,7 +975,7 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
972975
/// assert_eq!(*x, i);
973976
/// }
974977
/// ```
975-
#[unstable(feature = "new_uninit", issue = "63291")]
978+
#[unstable(feature = "box_uninit_write", issue = "129397")]
976979
#[inline]
977980
pub fn write(mut boxed: Self, value: T) -> Box<T, A> {
978981
unsafe {

Diff for: alloc/src/rc.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -539,6 +539,7 @@ impl<T> Rc<T> {
539539
/// # Examples
540540
///
541541
/// ```
542+
/// #![feature(new_zeroed_alloc)]
542543
/// #![feature(new_uninit)]
543544
///
544545
/// use std::rc::Rc;
@@ -551,7 +552,7 @@ impl<T> Rc<T> {
551552
///
552553
/// [zeroed]: mem::MaybeUninit::zeroed
553554
#[cfg(not(no_global_oom_handling))]
554-
#[unstable(feature = "new_uninit", issue = "63291")]
555+
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
555556
#[must_use]
556557
pub fn new_zeroed() -> Rc<mem::MaybeUninit<T>> {
557558
unsafe {
@@ -1000,6 +1001,7 @@ impl<T> Rc<[T]> {
10001001
///
10011002
/// ```
10021003
/// #![feature(new_uninit)]
1004+
/// #![feature(new_zeroed_alloc)]
10031005
///
10041006
/// use std::rc::Rc;
10051007
///
@@ -1011,7 +1013,7 @@ impl<T> Rc<[T]> {
10111013
///
10121014
/// [zeroed]: mem::MaybeUninit::zeroed
10131015
#[cfg(not(no_global_oom_handling))]
1014-
#[unstable(feature = "new_uninit", issue = "63291")]
1016+
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
10151017
#[must_use]
10161018
pub fn new_zeroed_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]> {
10171019
unsafe {

Diff for: alloc/src/sync.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,7 @@ impl<T> Arc<T> {
542542
/// # Examples
543543
///
544544
/// ```
545+
/// #![feature(new_zeroed_alloc)]
545546
/// #![feature(new_uninit)]
546547
///
547548
/// use std::sync::Arc;
@@ -555,7 +556,7 @@ impl<T> Arc<T> {
555556
/// [zeroed]: mem::MaybeUninit::zeroed
556557
#[cfg(not(no_global_oom_handling))]
557558
#[inline]
558-
#[unstable(feature = "new_uninit", issue = "63291")]
559+
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
559560
#[must_use]
560561
pub fn new_zeroed() -> Arc<mem::MaybeUninit<T>> {
561562
unsafe {
@@ -1134,6 +1135,7 @@ impl<T> Arc<[T]> {
11341135
/// # Examples
11351136
///
11361137
/// ```
1138+
/// #![feature(new_zeroed_alloc)]
11371139
/// #![feature(new_uninit)]
11381140
///
11391141
/// use std::sync::Arc;
@@ -1147,7 +1149,7 @@ impl<T> Arc<[T]> {
11471149
/// [zeroed]: mem::MaybeUninit::zeroed
11481150
#[cfg(not(no_global_oom_handling))]
11491151
#[inline]
1150-
#[unstable(feature = "new_uninit", issue = "63291")]
1152+
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
11511153
#[must_use]
11521154
pub fn new_zeroed_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
11531155
unsafe {
@@ -1191,7 +1193,7 @@ impl<T, A: Allocator> Arc<[T], A> {
11911193
/// assert_eq!(*values, [1, 2, 3])
11921194
/// ```
11931195
#[cfg(not(no_global_oom_handling))]
1194-
#[unstable(feature = "new_uninit", issue = "63291")]
1196+
#[unstable(feature = "allocator_api", issue = "32838")]
11951197
#[inline]
11961198
pub fn new_uninit_slice_in(len: usize, alloc: A) -> Arc<[mem::MaybeUninit<T>], A> {
11971199
unsafe { Arc::from_ptr_in(Arc::allocate_for_slice_in(len, &alloc), alloc) }
@@ -1220,7 +1222,7 @@ impl<T, A: Allocator> Arc<[T], A> {
12201222
///
12211223
/// [zeroed]: mem::MaybeUninit::zeroed
12221224
#[cfg(not(no_global_oom_handling))]
1223-
#[unstable(feature = "new_uninit", issue = "63291")]
1225+
#[unstable(feature = "allocator_api", issue = "32838")]
12241226
#[inline]
12251227
pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Arc<[mem::MaybeUninit<T>], A> {
12261228
unsafe {

Diff for: std/src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,7 @@
363363
#![feature(get_mut_unchecked)]
364364
#![feature(map_try_insert)]
365365
#![feature(new_uninit)]
366+
#![feature(new_zeroed_alloc)]
366367
#![feature(slice_concat_trait)]
367368
#![feature(thin_box)]
368369
#![feature(try_reserve_kind)]

0 commit comments

Comments
 (0)