@@ -85,6 +85,9 @@ pub use hack::into_vec;
8585#[ cfg( test) ]
8686pub use hack:: to_vec;
8787
88+ #[ cfg( test) ]
89+ pub use hack:: to_vec_co;
90+
8891// HACK(japaric): With cfg(test) `impl [T]` is not available, these three
8992// functions are actually methods that are in `impl [T]` but not in
9093// `core::slice::SliceExt` - we need to supply these functions for the
@@ -548,7 +551,20 @@ impl<T> [T] {
548551 #[ rustc_conversion_suggestion]
549552 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
550553 #[ 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 >
552568 where
553569 T : Clone ,
554570 [ ( ) ; { meta_num_slots_global ! ( CO_ALLOC_PREF ) } ] : ,
@@ -587,7 +603,7 @@ impl<T> [T] {
587603 #[ cfg( not( no_global_oom_handling) ) ]
588604 #[ rustc_allow_incoherent_impl]
589605 #[ inline]
590- #[ unstable( feature = "allocator_api " , issue = "32838 " ) ]
606+ #[ unstable( feature = "global_co_alloc " , issue = "none " ) ]
591607 #[ allow( unused_braces) ]
592608 pub fn to_vec_in_co < A : Allocator , const CO_ALLOC_PREF : CoAllocPref > ( & self , alloc : A ) -> Vec < T , A , CO_ALLOC_PREF >
593609 where
0 commit comments