@@ -158,6 +158,19 @@ where
158158 }
159159}
160160
161+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
162+ #[ allow( unused_braces) ]
163+ impl < T , const CO_ALLOC_PREF : CoAllocPref > Default for VecDeque < T , Global , CO_ALLOC_PREF >
164+ where
165+ [ ( ) ; { meta_num_slots_global ! ( CO_ALLOC_PREF ) } ] : ,
166+ {
167+ /// Creates an empty deque.
168+ #[ inline]
169+ default fn default ( ) -> VecDeque < T , Global , CO_ALLOC_PREF > {
170+ VecDeque :: < T , Global , CO_ALLOC_PREF > :: new_co ( )
171+ }
172+ }
173+
161174#[ stable( feature = "rust1" , since = "1.0.0" ) ]
162175#[ allow( unused_braces) ]
163176impl < T > Default for VecDeque < T > {
@@ -589,6 +602,32 @@ impl<T> VecDeque<T> {
589602 }
590603}
591604
605+ #[ allow( unused_braces) ]
606+ impl < T , const CO_ALLOC_PREF : CoAllocPref > VecDeque < T , Global , CO_ALLOC_PREF >
607+ where
608+ [ ( ) ; { crate :: meta_num_slots_global!( CO_ALLOC_PREF ) } ] : ,
609+ {
610+ /// Coallocation-aware version of `new`.
611+ #[ inline]
612+ #[ unstable( feature = "co_alloc_global" , issue="none" ) ]
613+ #[ must_use]
614+ #[ allow( unused_braces) ]
615+ pub const fn new_co ( ) -> VecDeque < T , Global , CO_ALLOC_PREF >
616+ {
617+ // FIXME: This should just be `VecDeque::new_in(Global)` once that hits stable.
618+ VecDeque { head : 0 , len : 0 , buf : RawVec :: NEW }
619+ }
620+
621+ /// Coallocation-aware version of `with_capacity`.
622+ #[ inline]
623+ #[ stable( feature = "rust1" , since = "1.0.0" ) ]
624+ #[ must_use]
625+ #[ allow( unused_braces) ]
626+ pub fn with_capacity_co ( capacity : usize ) -> VecDeque < T , Global , CO_ALLOC_PREF > {
627+ VecDeque :: < T , Global , CO_ALLOC_PREF > :: with_capacity_in ( capacity, Global )
628+ }
629+ }
630+
592631#[ allow( unused_braces) ]
593632impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > VecDeque < T , A , CO_ALLOC_PREF >
594633where
0 commit comments