@@ -158,6 +158,19 @@ where
158
158
}
159
159
}
160
160
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
+
161
174
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
162
175
#[ allow( unused_braces) ]
163
176
impl < T > Default for VecDeque < T > {
@@ -589,6 +602,32 @@ impl<T> VecDeque<T> {
589
602
}
590
603
}
591
604
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
+
592
631
#[ allow( unused_braces) ]
593
632
impl < T , A : Allocator , const CO_ALLOC_PREF : CoAllocPref > VecDeque < T , A , CO_ALLOC_PREF >
594
633
where
0 commit comments