@@ -143,7 +143,7 @@ use core::hash::{Hash, Hasher};
143
143
#[ cfg( not( no_global_oom_handling) ) ]
144
144
use core:: iter:: FromIterator ;
145
145
use core:: iter:: { FusedIterator , Iterator } ;
146
- use core:: marker:: { Unpin , Unsize } ;
146
+ use core:: marker:: { Destruct , Unpin , Unsize } ;
147
147
use core:: mem;
148
148
use core:: ops:: {
149
149
CoerceUnsized , Deref , DerefMut , DispatchFromDyn , Generator , GeneratorState , Receiver ,
@@ -349,9 +349,10 @@ impl<T, A: Allocator> Box<T, A> {
349
349
#[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
350
350
#[ must_use]
351
351
#[ inline]
352
+ #[ cfg_attr( not( bootstrap) , allow( drop_bounds) ) ] // FIXME remove `~const Drop` and this attr when bumping
352
353
pub const fn new_in ( x : T , alloc : A ) -> Self
353
354
where
354
- A : ~const Allocator + ~const Drop ,
355
+ A : ~const Allocator + ~const Drop + ~ const Destruct ,
355
356
{
356
357
let mut boxed = Self :: new_uninit_in ( alloc) ;
357
358
unsafe {
@@ -378,10 +379,11 @@ impl<T, A: Allocator> Box<T, A> {
378
379
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
379
380
#[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
380
381
#[ inline]
382
+ #[ cfg_attr( not( bootstrap) , allow( drop_bounds) ) ] // FIXME remove `~const Drop` and this attr when bumping
381
383
pub const fn try_new_in ( x : T , alloc : A ) -> Result < Self , AllocError >
382
384
where
383
- T : ~const Drop ,
384
- A : ~const Allocator + ~const Drop ,
385
+ T : ~const Drop + ~ const Destruct ,
386
+ A : ~const Allocator + ~const Drop + ~ const Destruct ,
385
387
{
386
388
let mut boxed = Self :: try_new_uninit_in ( alloc) ?;
387
389
unsafe {
@@ -415,9 +417,10 @@ impl<T, A: Allocator> Box<T, A> {
415
417
#[ cfg( not( no_global_oom_handling) ) ]
416
418
#[ must_use]
417
419
// #[unstable(feature = "new_uninit", issue = "63291")]
420
+ #[ cfg_attr( not( bootstrap) , allow( drop_bounds) ) ] // FIXME remove `~const Drop` and this attr when bumping
418
421
pub const fn new_uninit_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
419
422
where
420
- A : ~const Allocator + ~const Drop ,
423
+ A : ~const Allocator + ~const Drop + ~ const Destruct ,
421
424
{
422
425
let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
423
426
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -453,9 +456,10 @@ impl<T, A: Allocator> Box<T, A> {
453
456
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
454
457
// #[unstable(feature = "new_uninit", issue = "63291")]
455
458
#[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
459
+ #[ cfg_attr( not( bootstrap) , allow( drop_bounds) ) ] // FIXME remove `~const Drop` and this attr when bumping
456
460
pub const fn try_new_uninit_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
457
461
where
458
- A : ~const Allocator + ~const Drop ,
462
+ A : ~const Allocator + ~const Drop + ~ const Destruct ,
459
463
{
460
464
let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
461
465
let ptr = alloc. allocate ( layout) ?. cast ( ) ;
@@ -487,9 +491,10 @@ impl<T, A: Allocator> Box<T, A> {
487
491
#[ cfg( not( no_global_oom_handling) ) ]
488
492
// #[unstable(feature = "new_uninit", issue = "63291")]
489
493
#[ must_use]
494
+ #[ cfg_attr( not( bootstrap) , allow( drop_bounds) ) ] // FIXME remove `~const Drop` and this attr when bumping
490
495
pub const fn new_zeroed_in ( alloc : A ) -> Box < mem:: MaybeUninit < T > , A >
491
496
where
492
- A : ~const Allocator + ~const Drop ,
497
+ A : ~const Allocator + ~const Drop + ~ const Destruct ,
493
498
{
494
499
let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
495
500
// NOTE: Prefer match over unwrap_or_else since closure sometimes not inlineable.
@@ -525,9 +530,10 @@ impl<T, A: Allocator> Box<T, A> {
525
530
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
526
531
// #[unstable(feature = "new_uninit", issue = "63291")]
527
532
#[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
533
+ #[ cfg_attr( not( bootstrap) , allow( drop_bounds) ) ] // FIXME remove `~const Drop` and this attr when bumping
528
534
pub const fn try_new_zeroed_in ( alloc : A ) -> Result < Box < mem:: MaybeUninit < T > , A > , AllocError >
529
535
where
530
- A : ~const Allocator + ~const Drop ,
536
+ A : ~const Allocator + ~const Drop + ~ const Destruct ,
531
537
{
532
538
let layout = Layout :: new :: < mem:: MaybeUninit < T > > ( ) ;
533
539
let ptr = alloc. allocate_zeroed ( layout) ?. cast ( ) ;
@@ -541,9 +547,10 @@ impl<T, A: Allocator> Box<T, A> {
541
547
#[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
542
548
#[ must_use]
543
549
#[ inline( always) ]
550
+ #[ cfg_attr( not( bootstrap) , allow( drop_bounds) ) ] // FIXME remove `~const Drop` and this attr when bumping
544
551
pub const fn pin_in ( x : T , alloc : A ) -> Pin < Self >
545
552
where
546
- A : ' static + ~const Allocator + ~const Drop ,
553
+ A : ' static + ~const Allocator + ~const Drop + ~ const Destruct ,
547
554
{
548
555
Self :: into_pin ( Self :: new_in ( x, alloc) )
549
556
}
@@ -572,9 +579,10 @@ impl<T, A: Allocator> Box<T, A> {
572
579
#[ unstable( feature = "box_into_inner" , issue = "80437" ) ]
573
580
#[ rustc_const_unstable( feature = "const_box" , issue = "92521" ) ]
574
581
#[ inline]
582
+ #[ cfg_attr( not( bootstrap) , allow( drop_bounds) ) ] // FIXME remove `~const Drop` and this attr when bumping
575
583
pub const fn into_inner ( boxed : Self ) -> T
576
584
where
577
- Self : ~const Drop ,
585
+ Self : ~const Drop + ~ const Destruct ,
578
586
{
579
587
* boxed
580
588
}
0 commit comments