@@ -3491,14 +3491,28 @@ where
3491
3491
}
3492
3492
}
3493
3493
3494
- // note: test pulls in std, which causes errors here
3494
+ // @FIXME unsure about test
3495
3495
#[ cfg( not( test) ) ]
3496
- #[ stable( feature = "vec_from_box" , since = "1.18.0" ) ]
3496
+ #[ allow( ineffective_unstable_trait_impl) ] //@FIXME What/why is #[unstable(...)] ignored here?
3497
+ #[ unstable( feature = "global_co_alloc" , issue="none" ) ]
3497
3498
#[ allow( unused_braces) ]
3498
3499
impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > From < Box < [ T ] , A > >
3499
3500
for Vec < T , A , CO_ALLOC_PREF >
3500
3501
where
3501
3502
[ ( ) ; { crate :: meta_num_slots!( A , CO_ALLOC_PREF ) } ] : ,
3503
+ {
3504
+ default fn from ( s : Box < [ T ] , A > ) -> Self {
3505
+ s. into_vec_co ( )
3506
+ }
3507
+ }
3508
+
3509
+ #[ cfg( not( test) ) ]
3510
+ #[ stable( feature = "vec_from_box" , since = "1.18.0" ) ]
3511
+ #[ allow( unused_braces) ]
3512
+ impl < T , A : Allocator > From < Box < [ T ] , A > >
3513
+ for Vec < T , A , { CO_ALLOC_PREF_DEFAULT ! ( ) } >
3514
+ where
3515
+ [ ( ) ; { crate :: meta_num_slots_default!( A ) } ] : ,
3502
3516
{
3503
3517
/// Convert a boxed slice into a vector by transferring ownership of
3504
3518
/// the existing heap allocation.
@@ -3510,19 +3524,34 @@ where
3510
3524
/// assert_eq!(Vec::from(b), vec![1, 2, 3]);
3511
3525
/// ```
3512
3526
fn from ( s : Box < [ T ] , A > ) -> Self {
3513
- s. into_vec_co ( )
3527
+ s. into_vec ( )
3514
3528
}
3515
3529
}
3516
3530
3517
- // note: test pulls in std, which causes errors here
3518
3531
#[ cfg( not( no_global_oom_handling) ) ]
3532
+ // @FIXME Can this apply to test?
3519
3533
#[ cfg( not( test) ) ]
3520
- #[ stable( feature = "box_from_vec" , since = "1.20.0" ) ]
3534
+ #[ allow( ineffective_unstable_trait_impl) ] //@FIXME What/why is #[unstable(...)] ignored here?
3535
+ #[ unstable( feature = "global_co_alloc" , issue="none" ) ]
3521
3536
#[ allow( unused_braces) ]
3522
3537
impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > From < Vec < T , A , CO_ALLOC_PREF > >
3523
3538
for Box < [ T ] , A >
3524
3539
where
3525
3540
[ ( ) ; { crate :: meta_num_slots!( A , CO_ALLOC_PREF ) } ] : ,
3541
+ {
3542
+ default fn from ( v : Vec < T , A , CO_ALLOC_PREF > ) -> Self {
3543
+ v. into_boxed_slice ( )
3544
+ }
3545
+ }
3546
+ // note: test pulls in std, which causes errors here
3547
+ #[ cfg( not( no_global_oom_handling) ) ]
3548
+ #[ cfg( not( test) ) ]
3549
+ #[ stable( feature = "box_from_vec" , since = "1.20.0" ) ]
3550
+ #[ allow( unused_braces) ]
3551
+ impl < T , A : Allocator > From < Vec < T , A > >
3552
+ for Box < [ T ] , A >
3553
+ where
3554
+ [ ( ) ; { crate :: meta_num_slots_default!( A ) } ] : ,
3526
3555
{
3527
3556
/// Convert a vector into a boxed slice.
3528
3557
///
@@ -3542,7 +3571,7 @@ where
3542
3571
///
3543
3572
/// assert_eq!(Box::from(vec), vec![1, 2, 3].into_boxed_slice());
3544
3573
/// ```
3545
- fn from ( v : Vec < T , A , CO_ALLOC_PREF > ) -> Self {
3574
+ fn from ( v : Vec < T , A > ) -> Self {
3546
3575
v. into_boxed_slice ( )
3547
3576
}
3548
3577
}
0 commit comments