@@ -85,6 +85,9 @@ pub use hack::into_vec;
85
85
#[ cfg( test) ]
86
86
pub use hack:: to_vec;
87
87
88
+ #[ cfg( test) ]
89
+ pub use hack:: to_vec_co;
90
+
88
91
// HACK(japaric): With cfg(test) `impl [T]` is not available, these three
89
92
// functions are actually methods that are in `impl [T]` but not in
90
93
// `core::slice::SliceExt` - we need to supply these functions for the
@@ -548,7 +551,20 @@ impl<T> [T] {
548
551
#[ rustc_conversion_suggestion]
549
552
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
550
553
#[ inline]
551
- pub fn to_vec < const CO_ALLOC_PREF : CoAllocPref > ( & self ) -> Vec < T , Global , CO_ALLOC_PREF >
554
+ pub fn to_vec ( & self ) -> Vec < T >
555
+ where T : Clone
556
+ {
557
+ self . to_vec_in :: < Global > ( Global )
558
+ }
559
+
560
+ /// Coallocation-aware alternative to `to_vec`.
561
+ #[ cfg( not( no_global_oom_handling) ) ]
562
+ #[ rustc_allow_incoherent_impl]
563
+ #[ allow( unused_braces) ]
564
+ #[ rustc_conversion_suggestion]
565
+ #[ unstable( feature = "global_co_alloc" , issue = "none" ) ]
566
+ #[ inline]
567
+ pub fn to_vec_co < const CO_ALLOC_PREF : CoAllocPref > ( & self ) -> Vec < T , Global , CO_ALLOC_PREF >
552
568
where
553
569
T : Clone ,
554
570
[ ( ) ; { meta_num_slots_global ! ( CO_ALLOC_PREF ) } ] : ,
@@ -587,7 +603,7 @@ impl<T> [T] {
587
603
#[ cfg( not( no_global_oom_handling) ) ]
588
604
#[ rustc_allow_incoherent_impl]
589
605
#[ inline]
590
- #[ unstable( feature = "allocator_api " , issue = "32838 " ) ]
606
+ #[ unstable( feature = "global_co_alloc " , issue = "none " ) ]
591
607
#[ allow( unused_braces) ]
592
608
pub fn to_vec_in_co < A : Allocator , const CO_ALLOC_PREF : CoAllocPref > ( & self , alloc : A ) -> Vec < T , A , CO_ALLOC_PREF >
593
609
where
0 commit comments