Skip to content

Commit 6d1c12a

Browse files
committed
Stabilize new_zeroed_alloc
1 parent 9cd918b commit 6d1c12a

File tree

6 files changed

+10
-44
lines changed

6 files changed

+10
-44
lines changed

compiler/rustc_index/src/bit_set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ impl<T: Idx> ChunkedBitSet<T> {
638638
};
639639
#[cfg(not(feature = "nightly"))]
640640
let mut words = {
641-
// FIXME: unconditionally use `Rc::new_zeroed` once it is stable (#63291).
641+
// FIXME: unconditionally use `Rc::new_zeroed` once it is stable (#129396).
642642
let words = mem::MaybeUninit::<[Word; CHUNK_WORDS]>::zeroed();
643643
// SAFETY: `words` can safely be all zeroes.
644644
let words = unsafe { words.assume_init() };
@@ -704,7 +704,7 @@ impl<T: Idx> ChunkedBitSet<T> {
704704
};
705705
#[cfg(not(feature = "nightly"))]
706706
let mut words = {
707-
// FIXME: unconditionally use `Rc::new_zeroed` once it is stable (#63291).
707+
// FIXME: unconditionally use `Rc::new_zeroed` once it is stable (#129396).
708708
let words = mem::MaybeUninit::<[Word; CHUNK_WORDS]>::zeroed();
709709
// SAFETY: `words` can safely be all zeroes.
710710
let words = unsafe { words.assume_init() };

compiler/rustc_index/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1+
// FIXME(bootstrap): unconditionally use `Rc::new_zeroed`
12
// tidy-alphabetical-start
3+
#![cfg_attr(bootstrap, feature(new_zeroed_alloc))]
24
#![cfg_attr(all(feature = "nightly", test), feature(stmt_expr_attributes))]
35
#![cfg_attr(feature = "nightly", allow(internal_features))]
46
#![cfg_attr(feature = "nightly", feature(extend_one, step_trait, test))]
57
#![cfg_attr(feature = "nightly", feature(new_range_api))]
6-
#![cfg_attr(feature = "nightly", feature(new_zeroed_alloc))]
78
// tidy-alphabetical-end
89

910
pub mod bit_set;

library/alloc/src/boxed.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -290,8 +290,6 @@ impl<T> Box<T> {
290290
/// # Examples
291291
///
292292
/// ```
293-
/// #![feature(new_zeroed_alloc)]
294-
///
295293
/// let zero = Box::<u32>::new_zeroed();
296294
/// let zero = unsafe { zero.assume_init() };
297295
///
@@ -301,7 +299,7 @@ impl<T> Box<T> {
301299
/// [zeroed]: mem::MaybeUninit::zeroed
302300
#[cfg(not(no_global_oom_handling))]
303301
#[inline]
304-
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
302+
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
305303
#[must_use]
306304
pub fn new_zeroed() -> Box<mem::MaybeUninit<T>> {
307305
Self::new_zeroed_in(Global)
@@ -358,7 +356,6 @@ impl<T> Box<T> {
358356
/// # Ok::<(), std::alloc::AllocError>(())
359357
/// ```
360358
#[unstable(feature = "allocator_api", issue = "32838")]
361-
// #[unstable(feature = "new_uninit", issue = "63291")]
362359
#[inline]
363360
pub fn try_new_uninit() -> Result<Box<mem::MaybeUninit<T>>, AllocError> {
364361
Box::try_new_uninit_in(Global)
@@ -384,7 +381,6 @@ impl<T> Box<T> {
384381
///
385382
/// [zeroed]: mem::MaybeUninit::zeroed
386383
#[unstable(feature = "allocator_api", issue = "32838")]
387-
// #[unstable(feature = "new_uninit", issue = "63291")]
388384
#[inline]
389385
pub fn try_new_zeroed() -> Result<Box<mem::MaybeUninit<T>>, AllocError> {
390386
Box::try_new_zeroed_in(Global)
@@ -463,7 +459,6 @@ impl<T, A: Allocator> Box<T, A> {
463459
#[unstable(feature = "allocator_api", issue = "32838")]
464460
#[cfg(not(no_global_oom_handling))]
465461
#[must_use]
466-
// #[unstable(feature = "new_uninit", issue = "63291")]
467462
pub fn new_uninit_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
468463
where
469464
A: Allocator,
@@ -496,7 +491,6 @@ impl<T, A: Allocator> Box<T, A> {
496491
/// # Ok::<(), std::alloc::AllocError>(())
497492
/// ```
498493
#[unstable(feature = "allocator_api", issue = "32838")]
499-
// #[unstable(feature = "new_uninit", issue = "63291")]
500494
pub fn try_new_uninit_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
501495
where
502496
A: Allocator,
@@ -532,7 +526,6 @@ impl<T, A: Allocator> Box<T, A> {
532526
/// [zeroed]: mem::MaybeUninit::zeroed
533527
#[unstable(feature = "allocator_api", issue = "32838")]
534528
#[cfg(not(no_global_oom_handling))]
535-
// #[unstable(feature = "new_uninit", issue = "63291")]
536529
#[must_use]
537530
pub fn new_zeroed_in(alloc: A) -> Box<mem::MaybeUninit<T>, A>
538531
where
@@ -570,7 +563,6 @@ impl<T, A: Allocator> Box<T, A> {
570563
///
571564
/// [zeroed]: mem::MaybeUninit::zeroed
572565
#[unstable(feature = "allocator_api", issue = "32838")]
573-
// #[unstable(feature = "new_uninit", issue = "63291")]
574566
pub fn try_new_zeroed_in(alloc: A) -> Result<Box<mem::MaybeUninit<T>, A>, AllocError>
575567
where
576568
A: Allocator,
@@ -660,8 +652,6 @@ impl<T> Box<[T]> {
660652
/// # Examples
661653
///
662654
/// ```
663-
/// #![feature(new_zeroed_alloc)]
664-
///
665655
/// let values = Box::<[u32]>::new_zeroed_slice(3);
666656
/// let values = unsafe { values.assume_init() };
667657
///
@@ -670,7 +660,7 @@ impl<T> Box<[T]> {
670660
///
671661
/// [zeroed]: mem::MaybeUninit::zeroed
672662
#[cfg(not(no_global_oom_handling))]
673-
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
663+
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
674664
#[must_use]
675665
pub fn new_zeroed_slice(len: usize) -> Box<[mem::MaybeUninit<T>]> {
676666
unsafe { RawVec::with_capacity_zeroed(len).into_box(len) }
@@ -785,7 +775,6 @@ impl<T, A: Allocator> Box<[T], A> {
785775
/// ```
786776
#[cfg(not(no_global_oom_handling))]
787777
#[unstable(feature = "allocator_api", issue = "32838")]
788-
// #[unstable(feature = "new_uninit", issue = "63291")]
789778
#[must_use]
790779
pub fn new_uninit_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit<T>], A> {
791780
unsafe { RawVec::with_capacity_in(len, alloc).into_box(len) }
@@ -813,7 +802,6 @@ impl<T, A: Allocator> Box<[T], A> {
813802
/// [zeroed]: mem::MaybeUninit::zeroed
814803
#[cfg(not(no_global_oom_handling))]
815804
#[unstable(feature = "allocator_api", issue = "32838")]
816-
// #[unstable(feature = "new_uninit", issue = "63291")]
817805
#[must_use]
818806
pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Box<[mem::MaybeUninit<T>], A> {
819807
unsafe { RawVec::with_capacity_zeroed_in(len, alloc).into_box(len) }

library/alloc/src/rc.rs

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,6 @@ impl<T> Rc<T> {
515515
/// # Examples
516516
///
517517
/// ```
518-
/// #![feature(new_zeroed_alloc)]
519-
///
520518
/// use std::rc::Rc;
521519
///
522520
/// let zero = Rc::<u32>::new_zeroed();
@@ -527,7 +525,7 @@ impl<T> Rc<T> {
527525
///
528526
/// [zeroed]: mem::MaybeUninit::zeroed
529527
#[cfg(not(no_global_oom_handling))]
530-
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
528+
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
531529
#[must_use]
532530
pub fn new_zeroed() -> Rc<mem::MaybeUninit<T>> {
533531
unsafe {
@@ -589,7 +587,6 @@ impl<T> Rc<T> {
589587
/// # Ok::<(), std::alloc::AllocError>(())
590588
/// ```
591589
#[unstable(feature = "allocator_api", issue = "32838")]
592-
// #[unstable(feature = "new_uninit", issue = "63291")]
593590
pub fn try_new_uninit() -> Result<Rc<mem::MaybeUninit<T>>, AllocError> {
594591
unsafe {
595592
Ok(Rc::from_ptr(Rc::try_allocate_for_layout(
@@ -622,7 +619,6 @@ impl<T> Rc<T> {
622619
///
623620
/// [zeroed]: mem::MaybeUninit::zeroed
624621
#[unstable(feature = "allocator_api", issue = "32838")]
625-
//#[unstable(feature = "new_uninit", issue = "63291")]
626622
pub fn try_new_zeroed() -> Result<Rc<mem::MaybeUninit<T>>, AllocError> {
627623
unsafe {
628624
Ok(Rc::from_ptr(Rc::try_allocate_for_layout(
@@ -690,7 +686,6 @@ impl<T, A: Allocator> Rc<T, A> {
690686
/// ```
691687
#[cfg(not(no_global_oom_handling))]
692688
#[unstable(feature = "allocator_api", issue = "32838")]
693-
// #[unstable(feature = "new_uninit", issue = "63291")]
694689
#[inline]
695690
pub fn new_uninit_in(alloc: A) -> Rc<mem::MaybeUninit<T>, A> {
696691
unsafe {
@@ -728,7 +723,6 @@ impl<T, A: Allocator> Rc<T, A> {
728723
/// [zeroed]: mem::MaybeUninit::zeroed
729724
#[cfg(not(no_global_oom_handling))]
730725
#[unstable(feature = "allocator_api", issue = "32838")]
731-
// #[unstable(feature = "new_uninit", issue = "63291")]
732726
#[inline]
733727
pub fn new_zeroed_in(alloc: A) -> Rc<mem::MaybeUninit<T>, A> {
734728
unsafe {
@@ -873,7 +867,6 @@ impl<T, A: Allocator> Rc<T, A> {
873867
/// # Ok::<(), std::alloc::AllocError>(())
874868
/// ```
875869
#[unstable(feature = "allocator_api", issue = "32838")]
876-
// #[unstable(feature = "new_uninit", issue = "63291")]
877870
#[inline]
878871
pub fn try_new_uninit_in(alloc: A) -> Result<Rc<mem::MaybeUninit<T>, A>, AllocError> {
879872
unsafe {
@@ -912,7 +905,6 @@ impl<T, A: Allocator> Rc<T, A> {
912905
///
913906
/// [zeroed]: mem::MaybeUninit::zeroed
914907
#[unstable(feature = "allocator_api", issue = "32838")]
915-
//#[unstable(feature = "new_uninit", issue = "63291")]
916908
#[inline]
917909
pub fn try_new_zeroed_in(alloc: A) -> Result<Rc<mem::MaybeUninit<T>, A>, AllocError> {
918910
unsafe {
@@ -1054,8 +1046,6 @@ impl<T> Rc<[T]> {
10541046
/// # Examples
10551047
///
10561048
/// ```
1057-
/// #![feature(new_zeroed_alloc)]
1058-
///
10591049
/// use std::rc::Rc;
10601050
///
10611051
/// let values = Rc::<[u32]>::new_zeroed_slice(3);
@@ -1066,7 +1056,7 @@ impl<T> Rc<[T]> {
10661056
///
10671057
/// [zeroed]: mem::MaybeUninit::zeroed
10681058
#[cfg(not(no_global_oom_handling))]
1069-
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
1059+
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
10701060
#[must_use]
10711061
pub fn new_zeroed_slice(len: usize) -> Rc<[mem::MaybeUninit<T>]> {
10721062
unsafe {
@@ -1129,7 +1119,6 @@ impl<T, A: Allocator> Rc<[T], A> {
11291119
/// ```
11301120
#[cfg(not(no_global_oom_handling))]
11311121
#[unstable(feature = "allocator_api", issue = "32838")]
1132-
// #[unstable(feature = "new_uninit", issue = "63291")]
11331122
#[inline]
11341123
pub fn new_uninit_slice_in(len: usize, alloc: A) -> Rc<[mem::MaybeUninit<T>], A> {
11351124
unsafe { Rc::from_ptr_in(Rc::allocate_for_slice_in(len, &alloc), alloc) }
@@ -1158,7 +1147,6 @@ impl<T, A: Allocator> Rc<[T], A> {
11581147
/// [zeroed]: mem::MaybeUninit::zeroed
11591148
#[cfg(not(no_global_oom_handling))]
11601149
#[unstable(feature = "allocator_api", issue = "32838")]
1161-
// #[unstable(feature = "new_uninit", issue = "63291")]
11621150
#[inline]
11631151
pub fn new_zeroed_slice_in(len: usize, alloc: A) -> Rc<[mem::MaybeUninit<T>], A> {
11641152
unsafe {

library/alloc/src/sync.rs

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -516,8 +516,6 @@ impl<T> Arc<T> {
516516
/// # Examples
517517
///
518518
/// ```
519-
/// #![feature(new_zeroed_alloc)]
520-
///
521519
/// use std::sync::Arc;
522520
///
523521
/// let zero = Arc::<u32>::new_zeroed();
@@ -529,7 +527,7 @@ impl<T> Arc<T> {
529527
/// [zeroed]: mem::MaybeUninit::zeroed
530528
#[cfg(not(no_global_oom_handling))]
531529
#[inline]
532-
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
530+
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
533531
#[must_use]
534532
pub fn new_zeroed() -> Arc<mem::MaybeUninit<T>> {
535533
unsafe {
@@ -603,7 +601,6 @@ impl<T> Arc<T> {
603601
/// # Ok::<(), std::alloc::AllocError>(())
604602
/// ```
605603
#[unstable(feature = "allocator_api", issue = "32838")]
606-
// #[unstable(feature = "new_uninit", issue = "63291")]
607604
pub fn try_new_uninit() -> Result<Arc<mem::MaybeUninit<T>>, AllocError> {
608605
unsafe {
609606
Ok(Arc::from_ptr(Arc::try_allocate_for_layout(
@@ -636,7 +633,6 @@ impl<T> Arc<T> {
636633
///
637634
/// [zeroed]: mem::MaybeUninit::zeroed
638635
#[unstable(feature = "allocator_api", issue = "32838")]
639-
// #[unstable(feature = "new_uninit", issue = "63291")]
640636
pub fn try_new_zeroed() -> Result<Arc<mem::MaybeUninit<T>>, AllocError> {
641637
unsafe {
642638
Ok(Arc::from_ptr(Arc::try_allocate_for_layout(
@@ -703,7 +699,6 @@ impl<T, A: Allocator> Arc<T, A> {
703699
/// ```
704700
#[cfg(not(no_global_oom_handling))]
705701
#[unstable(feature = "allocator_api", issue = "32838")]
706-
// #[unstable(feature = "new_uninit", issue = "63291")]
707702
#[inline]
708703
pub fn new_uninit_in(alloc: A) -> Arc<mem::MaybeUninit<T>, A> {
709704
unsafe {
@@ -741,7 +736,6 @@ impl<T, A: Allocator> Arc<T, A> {
741736
/// [zeroed]: mem::MaybeUninit::zeroed
742737
#[cfg(not(no_global_oom_handling))]
743738
#[unstable(feature = "allocator_api", issue = "32838")]
744-
// #[unstable(feature = "new_uninit", issue = "63291")]
745739
#[inline]
746740
pub fn new_zeroed_in(alloc: A) -> Arc<mem::MaybeUninit<T>, A> {
747741
unsafe {
@@ -927,7 +921,6 @@ impl<T, A: Allocator> Arc<T, A> {
927921
/// # Ok::<(), std::alloc::AllocError>(())
928922
/// ```
929923
#[unstable(feature = "allocator_api", issue = "32838")]
930-
// #[unstable(feature = "new_uninit", issue = "63291")]
931924
#[inline]
932925
pub fn try_new_uninit_in(alloc: A) -> Result<Arc<mem::MaybeUninit<T>, A>, AllocError> {
933926
unsafe {
@@ -966,7 +959,6 @@ impl<T, A: Allocator> Arc<T, A> {
966959
///
967960
/// [zeroed]: mem::MaybeUninit::zeroed
968961
#[unstable(feature = "allocator_api", issue = "32838")]
969-
// #[unstable(feature = "new_uninit", issue = "63291")]
970962
#[inline]
971963
pub fn try_new_zeroed_in(alloc: A) -> Result<Arc<mem::MaybeUninit<T>, A>, AllocError> {
972964
unsafe {
@@ -1197,8 +1189,6 @@ impl<T> Arc<[T]> {
11971189
/// # Examples
11981190
///
11991191
/// ```
1200-
/// #![feature(new_zeroed_alloc)]
1201-
///
12021192
/// use std::sync::Arc;
12031193
///
12041194
/// let values = Arc::<[u32]>::new_zeroed_slice(3);
@@ -1210,7 +1200,7 @@ impl<T> Arc<[T]> {
12101200
/// [zeroed]: mem::MaybeUninit::zeroed
12111201
#[cfg(not(no_global_oom_handling))]
12121202
#[inline]
1213-
#[unstable(feature = "new_zeroed_alloc", issue = "129396")]
1203+
#[stable(feature = "new_zeroed_alloc", since = "CURRENT_RUSTC_VERSION")]
12141204
#[must_use]
12151205
pub fn new_zeroed_slice(len: usize) -> Arc<[mem::MaybeUninit<T>]> {
12161206
unsafe {

library/std/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,6 @@
376376
#![feature(allocator_api)]
377377
#![feature(get_mut_unchecked)]
378378
#![feature(map_try_insert)]
379-
#![feature(new_zeroed_alloc)]
380379
#![feature(slice_concat_trait)]
381380
#![feature(thin_box)]
382381
#![feature(try_reserve_kind)]

0 commit comments

Comments
 (0)