@@ -153,10 +153,10 @@ where [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRE
153
153
}
154
154
155
155
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
156
- impl < T > Default for VecDeque < T > {
156
+ impl < T , const COOP_PREFERRED : bool = true > Default for VecDeque < T , Global , COOP_PREFERRED > {
157
157
/// Creates an empty deque.
158
158
#[ inline]
159
- fn default ( ) -> VecDeque < T > {
159
+ fn default ( ) -> VecDeque < T , Global , COOP_PREFERRED > {
160
160
VecDeque :: new ( )
161
161
}
162
162
}
@@ -536,7 +536,8 @@ where [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRE
536
536
}
537
537
}
538
538
539
- impl < T > VecDeque < T > {
539
+ impl < T , Global , const COOP_PREFERRED : bool > VecDeque < T , Global , COOP_PREFERRED >
540
+ where [ ( ) ; alloc:: co_alloc_metadata_num_slots_with_preference :: < A > ( COOP_PREFERRED ) ] : {
540
541
/// Creates an empty deque.
541
542
///
542
543
/// # Examples
@@ -550,7 +551,7 @@ impl<T> VecDeque<T> {
550
551
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
551
552
#[ rustc_const_stable( feature = "const_vec_deque_new" , since = "CURRENT_RUSTC_VERSION" ) ]
552
553
#[ must_use]
553
- pub const fn new ( ) -> VecDeque < T > {
554
+ pub const fn new ( ) -> VecDeque < T , Global , COOP_PREFERRED > {
554
555
// FIXME: This should just be `VecDeque::new_in(Global)` once that hits stable.
555
556
VecDeque { head : 0 , len : 0 , buf : RawVec :: NEW }
556
557
}
@@ -567,7 +568,7 @@ impl<T> VecDeque<T> {
567
568
#[ inline]
568
569
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
569
570
#[ must_use]
570
- pub fn with_capacity ( capacity : usize ) -> VecDeque < T > {
571
+ pub fn with_capacity ( capacity : usize ) -> VecDeque < T , Global , COOP_PREFERRED > {
571
572
Self :: with_capacity_in ( capacity, Global )
572
573
}
573
574
}
@@ -585,7 +586,7 @@ where [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRE
585
586
/// ```
586
587
#[ inline]
587
588
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
588
- pub const fn new_in ( alloc : A ) -> VecDeque < T , A > {
589
+ pub const fn new_in ( alloc : A ) -> VecDeque < T , A , COOP_PREFERRED > {
589
590
VecDeque { head : 0 , len : 0 , buf : RawVec :: new_in ( alloc) }
590
591
}
591
592
@@ -599,7 +600,7 @@ where [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRE
599
600
/// let deque: VecDeque<u32> = VecDeque::with_capacity(10);
600
601
/// ```
601
602
#[ unstable( feature = "allocator_api" , issue = "32838" ) ]
602
- pub fn with_capacity_in ( capacity : usize , alloc : A ) -> VecDeque < T , A > {
603
+ pub fn with_capacity_in ( capacity : usize , alloc : A ) -> VecDeque < T , A , COOP_PREFERRED > {
603
604
VecDeque { head : 0 , len : 0 , buf : RawVec :: with_capacity_in ( capacity, alloc) }
604
605
}
605
606
@@ -2892,7 +2893,7 @@ where [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRE
2892
2893
/// assert_eq!(vec, [8, 9, 1, 2, 3, 4]);
2893
2894
/// assert_eq!(vec.as_ptr(), ptr);
2894
2895
/// ```
2895
- fn from ( mut other : VecDeque < T , A > ) -> Self {
2896
+ fn from < const _VECDEQUE_COOP_PREFERRED : bool > ( mut other : VecDeque < T , A , _VECDEQUE_COOP_PREFERRED > ) -> Self {
2896
2897
other. make_contiguous ( ) ;
2897
2898
2898
2899
unsafe {
@@ -2905,6 +2906,7 @@ where [(); alloc::co_alloc_metadata_num_slots_with_preference::<A>(COOP_PREFERRE
2905
2906
if other. head != 0 {
2906
2907
ptr:: copy ( buf. add ( other. head ) , buf, len) ;
2907
2908
}
2909
+ // @TODO:
2908
2910
Vec :: from_raw_parts_in ( buf, len, cap, alloc)
2909
2911
}
2910
2912
}
0 commit comments