@@ -161,7 +161,7 @@ use core::hash::{Hash, Hasher};
161161use core:: iter:: FromIterator ;
162162use core:: iter:: { FusedIterator , Iterator } ;
163163use core:: marker:: Tuple ;
164- use core:: marker:: { Destruct , Unpin , Unsize } ;
164+ use core:: marker:: { Unpin , Unsize } ;
165165use core:: mem;
166166use core:: ops:: {
167167 CoerceUnsized , Deref , DerefMut , DispatchFromDyn , Generator , GeneratorState , Receiver ,
@@ -381,12 +381,11 @@ impl<T, A: Allocator> Box<T, A> {
381381 /// ```
382382 #[ cfg( not( no_global_oom_handling) ) ]
383383 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
384- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
385384 #[ must_use]
386385 #[ inline]
387- pub const fn new_in ( x : T , alloc : A ) -> Self
386+ pub fn new_in ( x : T , alloc : A ) -> Self
388387 where
389- A : ~ const Allocator + ~ const Destruct ,
388+ A : Allocator ,
390389 {
391390 let mut boxed = Self :: new_uninit_in ( alloc) ;
392391 unsafe {
@@ -411,12 +410,10 @@ impl<T, A: Allocator> Box<T, A> {
411410 /// # Ok::<(), std::alloc::AllocError>(())
412411 /// ```
413412 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
414- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
415413 #[ inline]
416- pub const fn try_new_in ( x : T , alloc : A ) -> Result < Self , AllocError >
414+ pub fn try_new_in ( x : T , alloc : A ) -> Result < Self , AllocError >
417415 where
418- T : ~const Destruct ,
419- A : ~const Allocator + ~const Destruct ,
416+ A : Allocator ,
420417 {
421418 let mut boxed = Self :: try_new_uninit_in ( alloc) ?;
422419 unsafe {
@@ -446,13 +443,12 @@ impl<T, A: Allocator> Box<T, A> {
446443 /// assert_eq!(*five, 5)
447444 /// ```
448445 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
449- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
450446 #[ cfg( not( no_global_oom_handling) ) ]
451447 #[ must_use]
452448 // #[unstable(feature = "new_uninit", issue = "63291")]
453- pub const fn new_uninit_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
449+ pub fn new_uninit_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
454450 where
455- A : ~ const Allocator + ~ const Destruct ,
451+ A : Allocator ,
456452 {
457453 let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
458454 // NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -487,10 +483,9 @@ impl<T, A: Allocator> Box<T, A> {
487483 /// ```
488484 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
489485 // #[unstable(feature = "new_uninit", issue = "63291")]
490- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
491- pub const fn try_new_uninit_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
486+ pub fn try_new_uninit_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
492487 where
493- A : ~ const Allocator + ~ const Destruct ,
488+ A : Allocator ,
494489 {
495490 let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
496491 let ptr = alloc. allocate ( layout) ?. cast ( ) ;
@@ -518,13 +513,12 @@ impl<T, A: Allocator> Box<T, A> {
518513 ///
519514 /// [zeroed]: mem::MaybeUninit::zeroed
520515 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
521- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
522516 #[ cfg( not( no_global_oom_handling) ) ]
523517 // #[unstable(feature = "new_uninit", issue = "63291")]
524518 #[ must_use]
525- pub const fn new_zeroed_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
519+ pub fn new_zeroed_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
526520 where
527- A : ~ const Allocator + ~ const Destruct ,
521+ A : Allocator ,
528522 {
529523 let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
530524 // NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -559,10 +553,9 @@ impl<T, A: Allocator> Box<T, A> {
559553 /// [zeroed]: mem::MaybeUninit::zeroed
560554 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
561555 // #[unstable(feature = "new_uninit", issue = "63291")]
562- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
563- pub const fn try_new_zeroed_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
556+ pub fn try_new_zeroed_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
564557 where
565- A : ~ const Allocator + ~ const Destruct ,
558+ A : Allocator ,
566559 {
567560 let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
568561 let ptr = alloc. allocate_zeroed ( layout) ?. cast ( ) ;
@@ -578,12 +571,11 @@ impl<T, A: Allocator> Box<T, A> {
578571 /// construct a (pinned) `Box` in a different way than with [`Box::new_in`].
579572 #[ cfg( not( no_global_oom_handling) ) ]
580573 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
581- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
582574 #[ must_use]
583575 #[ inline( always) ]
584- pub const fn pin_in ( x : T , alloc : A ) -> Pin < Self >
576+ pub fn pin_in ( x : T , alloc : A ) -> Pin < Self >
585577 where
586- A : ' static + ~ const Allocator + ~ const Destruct ,
578+ A : ' static + Allocator ,
587579 {
588580 Self :: into_pin ( Self :: new_in ( x, alloc) )
589581 }
@@ -592,8 +584,7 @@ impl<T, A: Allocator> Box<T, A> {
592584 ///
593585 /// This conversion does not allocate on the heap and happens in place.
594586 #[ unstable( feature = "box_into_boxed_slice" , issue = "71582" ) ]
595- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
596- pub const fn into_boxed_slice ( boxed : Self ) -> Box < [ T ] , A > {
587+ pub fn into_boxed_slice ( boxed : Self ) -> Box < [ T ] , A > {
597588 let ( raw, alloc) = Box :: into_raw_with_allocator ( boxed) ;
598589 unsafe { Box :: from_raw_in ( raw as * mut [ T ; 1 ] , alloc) }
599590 }
@@ -610,11 +601,8 @@ impl<T, A: Allocator> Box<T, A> {
610601 /// assert_eq!(Box::into_inner(c), 5);
611602 /// ```
612603 #[ unstable( feature = "box_into_inner" , issue = "80437" ) ]
613- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
614604 #[ inline]
615- pub const fn into_inner ( boxed : Self ) -> T
616- where
617- Self : ~const Destruct ,
605+ pub fn into_inner ( boxed : Self ) -> T
618606 {
619607 * boxed
620608 }
@@ -829,9 +817,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
829817 /// assert_eq!(*five, 5)
830818 /// ```
831819 #[ unstable( feature = "new_uninit" , issue = "63291" ) ]
832- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
833820 #[ inline]
834- pub const unsafe fn assume_init ( self ) -> Box < T , A > {
821+ pub unsafe fn assume_init ( self ) -> Box < T , A > {
835822 let ( raw, alloc) = Box :: into_raw_with_allocator ( self ) ;
836823 unsafe { Box :: from_raw_in ( raw as * mut T , alloc) }
837824 }
@@ -864,9 +851,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
864851 /// }
865852 /// ```
866853 #[ unstable( feature = "new_uninit" , issue = "63291" ) ]
867- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
868854 #[ inline]
869- pub const fn write ( mut boxed : Self , value : T ) -> Box < T , A > {
855+ pub fn write ( mut boxed : Self , value : T ) -> Box < T , A > {
870856 unsafe {
871857 ( * boxed) . write ( value) ;
872858 boxed. assume_init ( )
@@ -1012,9 +998,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
1012998 /// [memory layout]: self#memory-layout
1013999 /// [`Layout`]: crate::Layout
10141000 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1015- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
10161001 #[ inline]
1017- pub const unsafe fn from_raw_in ( raw : * mut T , alloc : A ) -> Self {
1002+ pub unsafe fn from_raw_in ( raw : * mut T , alloc : A ) -> Self {
10181003 Box ( unsafe { Unique :: new_unchecked ( raw) } , alloc)
10191004 }
10201005
@@ -1110,9 +1095,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11101095 ///
11111096 /// [memory layout]: self#memory-layout
11121097 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1113- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
11141098 #[ inline]
1115- pub const fn into_raw_with_allocator ( b : Self ) -> ( * mut T , A ) {
1099+ pub fn into_raw_with_allocator ( b : Self ) -> ( * mut T , A ) {
11161100 let ( leaked, alloc) = Box :: into_unique ( b) ;
11171101 ( leaked. as_ptr ( ) , alloc)
11181102 }
@@ -1122,10 +1106,9 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11221106 issue = "none" ,
11231107 reason = "use `Box::leak(b).into()` or `Unique::from(Box::leak(b))` instead"
11241108 ) ]
1125- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
11261109 #[ inline]
11271110 #[ doc( hidden) ]
1128- pub const fn into_unique ( b : Self ) -> ( Unique < T > , A ) {
1111+ pub fn into_unique ( b : Self ) -> ( Unique < T > , A ) {
11291112 // Box is recognized as a "unique pointer" by Stacked Borrows, but internally it is a
11301113 // raw pointer for the type system. Turning it directly into a raw pointer would not be
11311114 // recognized as "releasing" the unique pointer to permit aliased raw accesses,
@@ -1141,9 +1124,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11411124 /// to call it as `Box::allocator(&b)` instead of `b.allocator()`. This
11421125 /// is so that there is no conflict with a method on the inner type.
11431126 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1144- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
11451127 #[ inline]
1146- pub const fn allocator ( b : & Self ) -> & A {
1128+ pub fn allocator ( b : & Self ) -> & A {
11471129 & b. 1
11481130 }
11491131
@@ -1183,9 +1165,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11831165 /// assert_eq!(*static_ref, [4, 2, 3]);
11841166 /// ```
11851167 #[ stable( feature = "box_leak" , since = "1.26.0" ) ]
1186- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
11871168 #[ inline]
1188- pub const fn leak < ' a > ( b : Self ) -> & ' a mut T
1169+ pub fn leak < ' a > ( b : Self ) -> & ' a mut T
11891170 where
11901171 A : ' a ,
11911172 {
@@ -1223,8 +1204,7 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
12231204 /// let bar = Pin::from(foo);
12241205 /// ```
12251206 #[ stable( feature = "box_into_pin" , since = "1.63.0" ) ]
1226- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
1227- pub const fn into_pin ( boxed : Self ) -> Pin < Self >
1207+ pub fn into_pin ( boxed : Self ) -> Pin < Self >
12281208 where
12291209 A : ' static ,
12301210 {
@@ -1254,8 +1234,7 @@ impl<T: Default> Default for Box<T> {
12541234
12551235#[ cfg( not( no_global_oom_handling) ) ]
12561236#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1257- #[ rustc_const_unstable( feature = "const_default_impls" , issue = "87864" ) ]
1258- impl < T > const Default for Box < [ T ] > {
1237+ impl < T > Default for Box < [ T ] > {
12591238 fn default ( ) -> Self {
12601239 let ptr: Unique < [ T ] > = Unique :: < [ T ; 0 ] > :: dangling ( ) ;
12611240 Box ( ptr, Global )
@@ -1264,8 +1243,7 @@ impl<T> const Default for Box<[T]> {
12641243
12651244#[ cfg( not( no_global_oom_handling) ) ]
12661245#[ stable( feature = "default_box_extra" , since = "1.17.0" ) ]
1267- #[ rustc_const_unstable( feature = "const_default_impls" , issue = "87864" ) ]
1268- impl const Default for Box < str > {
1246+ impl Default for Box < str > {
12691247 fn default ( ) -> Self {
12701248 // SAFETY: This is the same as `Unique::cast<U>` but with an unsized `U = str`.
12711249 let ptr: Unique < str > = unsafe {
@@ -1461,8 +1439,7 @@ impl<T> From<T> for Box<T> {
14611439}
14621440
14631441#[ stable( feature = "pin" , since = "1.33.0" ) ]
1464- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
1465- impl < T : ?Sized , A : Allocator > const From < Box < T , A > > for Pin < Box < T , A > >
1442+ impl < T : ?Sized , A : Allocator > From < Box < T , A > > for Pin < Box < T , A > >
14661443where
14671444 A : ' static ,
14681445{
@@ -1899,8 +1876,7 @@ impl<T: ?Sized, A: Allocator> fmt::Pointer for Box<T, A> {
18991876}
19001877
19011878#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1902- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
1903- impl < T : ?Sized , A : Allocator > const Deref for Box < T , A > {
1879+ impl < T : ?Sized , A : Allocator > Deref for Box < T , A > {
19041880 type Target = T ;
19051881
19061882 fn deref ( & self ) -> & T {
@@ -1909,8 +1885,7 @@ impl<T: ?Sized, A: Allocator> const Deref for Box<T, A> {
19091885}
19101886
19111887#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1912- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
1913- impl < T : ?Sized , A : Allocator > const DerefMut for Box < T , A > {
1888+ impl < T : ?Sized , A : Allocator > DerefMut for Box < T , A > {
19141889 fn deref_mut ( & mut self ) -> & mut T {
19151890 & mut * * self
19161891 }
0 commit comments