@@ -159,7 +159,7 @@ use core::hash::{Hash, Hasher};
159
159
use core:: iter:: FromIterator ;
160
160
use core:: iter:: { FusedIterator , Iterator } ;
161
161
use core:: marker:: Tuple ;
162
- use core:: marker:: { Destruct , Unpin , Unsize } ;
162
+ use core:: marker:: { Unpin , Unsize } ;
163
163
use core:: mem;
164
164
use core:: ops:: {
165
165
CoerceUnsized , Deref , DerefMut , DispatchFromDyn , Generator , GeneratorState , Receiver ,
@@ -376,12 +376,11 @@ impl<T, A: Allocator> Box<T, A> {
376
376
/// ```
377
377
#[ cfg( not( no_global_oom_handling) ) ]
378
378
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
379
- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
380
379
#[ must_use]
381
380
#[ inline]
382
- pub const fn new_in ( x : T , alloc : A ) -> Self
381
+ pub fn new_in ( x : T , alloc : A ) -> Self
383
382
where
384
- A : ~ const Allocator + ~ const Destruct ,
383
+ A : Allocator ,
385
384
{
386
385
let mut boxed = Self :: new_uninit_in ( alloc) ;
387
386
unsafe {
@@ -406,12 +405,10 @@ impl<T, A: Allocator> Box<T, A> {
406
405
/// # Ok::<(), std::alloc::AllocError>(())
407
406
/// ```
408
407
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
409
- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
410
408
#[ inline]
411
- pub const fn try_new_in ( x : T , alloc : A ) -> Result < Self , AllocError >
409
+ pub fn try_new_in ( x : T , alloc : A ) -> Result < Self , AllocError >
412
410
where
413
- T : ~const Destruct ,
414
- A : ~const Allocator + ~const Destruct ,
411
+ A : Allocator ,
415
412
{
416
413
let mut boxed = Self :: try_new_uninit_in ( alloc) ?;
417
414
unsafe {
@@ -441,13 +438,12 @@ impl<T, A: Allocator> Box<T, A> {
441
438
/// assert_eq!(*five, 5)
442
439
/// ```
443
440
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
444
- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
445
441
#[ cfg( not( no_global_oom_handling) ) ]
446
442
#[ must_use]
447
443
// #[unstable(feature = "new_uninit", issue = "63291")]
448
- pub const fn new_uninit_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
444
+ pub fn new_uninit_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
449
445
where
450
- A : ~ const Allocator + ~ const Destruct ,
446
+ A : Allocator ,
451
447
{
452
448
let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
453
449
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -482,10 +478,9 @@ impl<T, A: Allocator> Box<T, A> {
482
478
/// ```
483
479
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
484
480
// #[unstable(feature = "new_uninit", issue = "63291")]
485
- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
486
- pub const fn try_new_uninit_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
481
+ pub fn try_new_uninit_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
487
482
where
488
- A : ~ const Allocator + ~ const Destruct ,
483
+ A : Allocator ,
489
484
{
490
485
let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
491
486
let ptr = alloc. allocate ( layout) ?. cast ( ) ;
@@ -513,13 +508,12 @@ impl<T, A: Allocator> Box<T, A> {
513
508
///
514
509
/// [zeroed]: mem::MaybeUninit::zeroed
515
510
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
516
- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
517
511
#[ cfg( not( no_global_oom_handling) ) ]
518
512
// #[unstable(feature = "new_uninit", issue = "63291")]
519
513
#[ must_use]
520
- pub const fn new_zeroed_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
514
+ pub fn new_zeroed_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
521
515
where
522
- A : ~ const Allocator + ~ const Destruct ,
516
+ A : Allocator ,
523
517
{
524
518
let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
525
519
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -554,10 +548,9 @@ impl<T, A: Allocator> Box<T, A> {
554
548
/// [zeroed]: mem::MaybeUninit::zeroed
555
549
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
556
550
// #[unstable(feature = "new_uninit", issue = "63291")]
557
- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
558
- pub const fn try_new_zeroed_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
551
+ pub fn try_new_zeroed_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
559
552
where
560
- A : ~ const Allocator + ~ const Destruct ,
553
+ A : Allocator ,
561
554
{
562
555
let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
563
556
let ptr = alloc. allocate_zeroed ( layout) ?. cast ( ) ;
@@ -573,12 +566,11 @@ impl<T, A: Allocator> Box<T, A> {
573
566
/// construct a (pinned) `Box` in a different way than with [`Box::new_in`].
574
567
#[ cfg( not( no_global_oom_handling) ) ]
575
568
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
576
- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
577
569
#[ must_use]
578
570
#[ inline( always) ]
579
- pub const fn pin_in ( x : T , alloc : A ) -> Pin < Self >
571
+ pub fn pin_in ( x : T , alloc : A ) -> Pin < Self >
580
572
where
581
- A : ' static + ~ const Allocator + ~ const Destruct ,
573
+ A : ' static + Allocator ,
582
574
{
583
575
Self :: into_pin ( Self :: new_in ( x, alloc) )
584
576
}
@@ -605,12 +597,8 @@ impl<T, A: Allocator> Box<T, A> {
605
597
/// assert_eq!(Box::into_inner(c), 5);
606
598
/// ```
607
599
#[ unstable( feature = "box_into_inner" , issue = "80437" ) ]
608
- #[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
609
600
#[ inline]
610
- pub const fn into_inner ( boxed : Self ) -> T
611
- where
612
- Self : ~const Destruct ,
613
- {
601
+ pub fn into_inner ( boxed : Self ) -> T {
614
602
* boxed
615
603
}
616
604
}
0 commit comments