@@ -157,7 +157,7 @@ use core::hash::{Hash, Hasher};
157157#[ cfg( not( no_global_oom_handling) ) ]
158158use core:: iter:: FromIterator ;
159159use core:: iter:: { FusedIterator , Iterator } ;
160- use core:: marker:: { Destruct , Unpin , Unsize } ;
160+ use core:: marker:: { Unpin , Unsize } ;
161161use core:: mem;
162162use core:: ops:: {
163163 CoerceUnsized , Deref , DerefMut , DispatchFromDyn , Generator , GeneratorState , Receiver ,
@@ -373,12 +373,11 @@ impl<T, A: Allocator> Box<T, A> {
373373 /// ```
374374 #[ cfg( not( no_global_oom_handling) ) ]
375375 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
376- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
377376 #[ must_use]
378377 #[ inline]
379- pub const fn new_in ( x : T , alloc : A ) -> Self
378+ pub fn new_in ( x : T , alloc : A ) -> Self
380379 where
381- A : ~ const Allocator + ~ const Destruct ,
380+ A : Allocator ,
382381 {
383382 let mut boxed = Self :: new_uninit_in ( alloc) ;
384383 unsafe {
@@ -403,12 +402,10 @@ impl<T, A: Allocator> Box<T, A> {
403402 /// # Ok::<(), std::alloc::AllocError>(())
404403 /// ```
405404 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
406- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
407405 #[ inline]
408- pub const fn try_new_in ( x : T , alloc : A ) -> Result < Self , AllocError >
406+ pub fn try_new_in ( x : T , alloc : A ) -> Result < Self , AllocError >
409407 where
410- T : ~const Destruct ,
411- A : ~const Allocator + ~const Destruct ,
408+ A : Allocator ,
412409 {
413410 let mut boxed = Self :: try_new_uninit_in ( alloc) ?;
414411 unsafe {
@@ -438,13 +435,12 @@ impl<T, A: Allocator> Box<T, A> {
438435 /// assert_eq!(*five, 5)
439436 /// ```
440437 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
441- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
442438 #[ cfg( not( no_global_oom_handling) ) ]
443439 #[ must_use]
444440 // #[unstable(feature = "new_uninit", issue = "63291")]
445- pub const fn new_uninit_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
441+ pub fn new_uninit_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
446442 where
447- A : ~ const Allocator + ~ const Destruct ,
443+ A : Allocator ,
448444 {
449445 let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
450446 // NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -479,10 +475,9 @@ impl<T, A: Allocator> Box<T, A> {
479475 /// ```
480476 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
481477 // #[unstable(feature = "new_uninit", issue = "63291")]
482- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
483- pub const fn try_new_uninit_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
478+ pub fn try_new_uninit_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
484479 where
485- A : ~ const Allocator + ~ const Destruct ,
480+ A : Allocator ,
486481 {
487482 let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
488483 let ptr = alloc. allocate ( layout) ?. cast ( ) ;
@@ -510,13 +505,12 @@ impl<T, A: Allocator> Box<T, A> {
510505 ///
511506 /// [zeroed]: mem::MaybeUninit::zeroed
512507 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
513- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
514508 #[ cfg( not( no_global_oom_handling) ) ]
515509 // #[unstable(feature = "new_uninit", issue = "63291")]
516510 #[ must_use]
517- pub const fn new_zeroed_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
511+ pub fn new_zeroed_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
518512 where
519- A : ~ const Allocator + ~ const Destruct ,
513+ A : Allocator ,
520514 {
521515 let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
522516 // NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -551,10 +545,9 @@ impl<T, A: Allocator> Box<T, A> {
551545 /// [zeroed]: mem::MaybeUninit::zeroed
552546 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
553547 // #[unstable(feature = "new_uninit", issue = "63291")]
554- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
555- pub const fn try_new_zeroed_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
548+ pub fn try_new_zeroed_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
556549 where
557- A : ~ const Allocator + ~ const Destruct ,
550+ A : Allocator ,
558551 {
559552 let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
560553 let ptr = alloc. allocate_zeroed ( layout) ?. cast ( ) ;
@@ -570,12 +563,11 @@ impl<T, A: Allocator> Box<T, A> {
570563 /// construct a (pinned) `Box` in a different way than with [`Box::new_in`].
571564 #[ cfg( not( no_global_oom_handling) ) ]
572565 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
573- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
574566 #[ must_use]
575567 #[ inline( always) ]
576- pub const fn pin_in ( x : T , alloc : A ) -> Pin < Self >
568+ pub fn pin_in ( x : T , alloc : A ) -> Pin < Self >
577569 where
578- A : ' static + ~ const Allocator + ~ const Destruct ,
570+ A : ' static + Allocator ,
579571 {
580572 Self :: into_pin ( Self :: new_in ( x, alloc) )
581573 }
@@ -584,8 +576,7 @@ impl<T, A: Allocator> Box<T, A> {
584576 ///
585577 /// This conversion does not allocate on the heap and happens in place.
586578 #[ unstable( feature = "box_into_boxed_slice" , issue = "71582" ) ]
587- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
588- pub const fn into_boxed_slice ( boxed : Self ) -> Box < [ T ] , A > {
579+ pub fn into_boxed_slice ( boxed : Self ) -> Box < [ T ] , A > {
589580 let ( raw, alloc) = Box :: into_raw_with_allocator ( boxed) ;
590581 unsafe { Box :: from_raw_in ( raw as * mut [ T ; 1 ] , alloc) }
591582 }
@@ -602,12 +593,8 @@ impl<T, A: Allocator> Box<T, A> {
602593 /// assert_eq!(Box::into_inner(c), 5);
603594 /// ```
604595 #[ unstable( feature = "box_into_inner" , issue = "80437" ) ]
605- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
606596 #[ inline]
607- pub const fn into_inner ( boxed : Self ) -> T
608- where
609- Self : ~const Destruct ,
610- {
597+ pub fn into_inner ( boxed : Self ) -> T {
611598 * boxed
612599 }
613600}
@@ -821,9 +808,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
821808 /// assert_eq!(*five, 5)
822809 /// ```
823810 #[ unstable( feature = "new_uninit" , issue = "63291" ) ]
824- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
825811 #[ inline]
826- pub const unsafe fn assume_init ( self ) -> Box < T , A > {
812+ pub unsafe fn assume_init ( self ) -> Box < T , A > {
827813 let ( raw, alloc) = Box :: into_raw_with_allocator ( self ) ;
828814 unsafe { Box :: from_raw_in ( raw as * mut T , alloc) }
829815 }
@@ -856,9 +842,8 @@ impl<T, A: Allocator> Box<mem::MaybeUninit<T>, A> {
856842 /// }
857843 /// ```
858844 #[ unstable( feature = "new_uninit" , issue = "63291" ) ]
859- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
860845 #[ inline]
861- pub const fn write ( mut boxed : Self , value : T ) -> Box < T , A > {
846+ pub fn write ( mut boxed : Self , value : T ) -> Box < T , A > {
862847 unsafe {
863848 ( * boxed) . write ( value) ;
864849 boxed. assume_init ( )
@@ -1101,9 +1086,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11011086 ///
11021087 /// [memory layout]: self#memory-layout
11031088 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
1104- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
11051089 #[ inline]
1106- pub const fn into_raw_with_allocator ( b : Self ) -> ( * mut T , A ) {
1090+ pub fn into_raw_with_allocator ( b : Self ) -> ( * mut T , A ) {
11071091 let ( leaked, alloc) = Box :: into_unique ( b) ;
11081092 ( leaked. as_ptr ( ) , alloc)
11091093 }
@@ -1113,10 +1097,9 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11131097 issue = "none" ,
11141098 reason = "use `Box::leak(b).into()` or `Unique::from(Box::leak(b))` instead"
11151099 ) ]
1116- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
11171100 #[ inline]
11181101 #[ doc( hidden) ]
1119- pub const fn into_unique ( b : Self ) -> ( Unique < T > , A ) {
1102+ pub fn into_unique ( b : Self ) -> ( Unique < T > , A ) {
11201103 // Box is recognized as a "unique pointer" by Stacked Borrows, but internally it is a
11211104 // raw pointer for the type system. Turning it directly into a raw pointer would not be
11221105 // recognized as "releasing" the unique pointer to permit aliased raw accesses,
@@ -1174,9 +1157,8 @@ impl<T: ?Sized, A: Allocator> Box<T, A> {
11741157 /// assert_eq!(*static_ref, [4, 2, 3]);
11751158 /// ```
11761159 #[ stable( feature = "box_leak" , since = "1.26.0" ) ]
1177- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
11781160 #[ inline]
1179- pub const fn leak < ' a > ( b : Self ) -> & ' a mut T
1161+ pub fn leak < ' a > ( b : Self ) -> & ' a mut T
11801162 where
11811163 A : ' a ,
11821164 {
@@ -1246,7 +1228,7 @@ impl<T: Default> Default for Box<T> {
12461228#[ cfg( not( no_global_oom_handling) ) ]
12471229#[ stable( feature = "rust1" , since = "1.0.0" ) ]
12481230#[ rustc_const_unstable( feature = "const_default_impls" , issue = "87864" ) ]
1249- impl < T > const Default for Box < [ T ] > {
1231+ impl < T > Default for Box < [ T ] > {
12501232 fn default ( ) -> Self {
12511233 let ptr: Unique < [ T ] > = Unique :: < [ T ; 0 ] > :: dangling ( ) ;
12521234 Box ( ptr, Global )
@@ -1256,7 +1238,7 @@ impl<T> const Default for Box<[T]> {
12561238#[ cfg( not( no_global_oom_handling) ) ]
12571239#[ stable( feature = "default_box_extra" , since = "1.17.0" ) ]
12581240#[ rustc_const_unstable( feature = "const_default_impls" , issue = "87864" ) ]
1259- impl const Default for Box < str > {
1241+ impl Default for Box < str > {
12601242 fn default ( ) -> Self {
12611243 // SAFETY: This is the same as `Unique::cast<U>` but with an unsized `U = str`.
12621244 let ptr: Unique < str > = unsafe {
@@ -1452,8 +1434,7 @@ impl<T> From<T> for Box<T> {
14521434}
14531435
14541436#[ stable( feature = "pin" , since = "1.33.0" ) ]
1455- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
1456- impl < T : ?Sized , A : Allocator > const From < Box < T , A > > for Pin < Box < T , A > >
1437+ impl < T : ?Sized , A : Allocator > From < Box < T , A > > for Pin < Box < T , A > >
14571438where
14581439 A : ' static ,
14591440{
@@ -1841,8 +1822,7 @@ impl<T: ?Sized, A: Allocator> fmt::Pointer for Box<T, A> {
18411822}
18421823
18431824#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1844- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
1845- impl < T : ?Sized , A : Allocator > const Deref for Box < T , A > {
1825+ impl < T : ?Sized , A : Allocator > Deref for Box < T , A > {
18461826 type Target = T ;
18471827
18481828 fn deref ( & self ) -> & T {
@@ -1851,8 +1831,7 @@ impl<T: ?Sized, A: Allocator> const Deref for Box<T, A> {
18511831}
18521832
18531833#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1854- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
1855- impl < T : ?Sized , A : Allocator > const DerefMut for Box < T , A > {
1834+ impl < T : ?Sized , A : Allocator > DerefMut for Box < T , A > {
18561835 fn deref_mut ( & mut self ) -> & mut T {
18571836 & mut * * self
18581837 }
@@ -2031,8 +2010,7 @@ impl<T: ?Sized, A: Allocator> AsMut<T> for Box<T, A> {
20312010 * could have a method to project a Pin<T> from it.
20322011 */
20332012#[ stable( feature = "pin" , since = "1.33.0" ) ]
2034- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
2035- impl < T : ?Sized , A : Allocator > const Unpin for Box < T , A > where A : ' static { }
2013+ impl < T : ?Sized , A : Allocator > Unpin for Box < T , A > where A : ' static { }
20362014
20372015#[ unstable( feature = "generator_trait" , issue = "43122" ) ]
20382016impl < G : ?Sized + Generator < R > + Unpin , R , A : Allocator > Generator < R > for Box < G , A >
0 commit comments