@@ -1480,13 +1480,19 @@ where
1480
1480
where
1481
1481
F : FnMut ( char ) -> bool ,
1482
1482
{
1483
- struct SetLenOnDrop < ' a > {
1484
- s : & ' a mut String ,
1483
+ struct SetLenOnDrop < ' a , const LOCAL_COOP_PREFERRED : bool >
1484
+ where
1485
+ [ ( ) ; core:: alloc:: co_alloc_metadata_num_slots_with_preference :: < Global > ( LOCAL_COOP_PREFERRED ) ] : ,
1486
+ {
1487
+ s : & ' a mut String < LOCAL_COOP_PREFERRED > ,
1485
1488
idx : usize ,
1486
1489
del_bytes : usize ,
1487
1490
}
1488
1491
1489
- impl < ' a > Drop for SetLenOnDrop < ' a > {
1492
+ impl < ' a , const LOCAL_COOP_PREFERRED : bool > Drop for SetLenOnDrop < ' a , LOCAL_COOP_PREFERRED >
1493
+ where
1494
+ [ ( ) ; core:: alloc:: co_alloc_metadata_num_slots_with_preference :: < Global > ( LOCAL_COOP_PREFERRED ) ] : ,
1495
+ {
1490
1496
fn drop ( & mut self ) {
1491
1497
let new_len = self . idx - self . del_bytes ;
1492
1498
debug_assert ! ( new_len <= self . s. len( ) ) ;
@@ -1783,7 +1789,7 @@ where
1783
1789
/// assert_eq!(s, "");
1784
1790
/// ```
1785
1791
#[ stable( feature = "drain" , since = "1.6.0" ) ]
1786
- pub fn drain < R > ( & mut self , range : R ) -> Drain < ' _ >
1792
+ pub fn drain < R > ( & mut self , range : R ) -> Drain < ' _ , COOP_PREFERRED >
1787
1793
where
1788
1794
R : RangeBounds < usize > ,
1789
1795
{
@@ -2216,16 +2222,16 @@ where [(); core::alloc::co_alloc_metadata_num_slots_with_preference::<Global>(CO
2216
2222
2217
2223
#[ cfg( not( no_global_oom_handling) ) ]
2218
2224
#[ stable( feature = "extend_string" , since = "1.4.0" ) ]
2219
- impl < const COOP_PREFERRED : bool > Extend < String > for String < COOP_PREFERRED >
2225
+ impl < const COOP_PREFERRED : bool > Extend < String < COOP_PREFERRED > > for String < COOP_PREFERRED >
2220
2226
where
2221
2227
[ ( ) ; core:: alloc:: co_alloc_metadata_num_slots_with_preference :: < Global > ( COOP_PREFERRED ) ] : ,
2222
2228
{
2223
- fn extend < I : IntoIterator < Item = String > > ( & mut self , iter : I ) {
2229
+ fn extend < I : IntoIterator < Item = String < COOP_PREFERRED > > > ( & mut self , iter : I ) {
2224
2230
iter. into_iter ( ) . for_each ( move |s| self . push_str ( & s) ) ;
2225
2231
}
2226
2232
2227
2233
#[ inline]
2228
- fn extend_one ( & mut self , s : String ) {
2234
+ fn extend_one ( & mut self , s : String < COOP_PREFERRED > ) {
2229
2235
self . push_str ( & s) ;
2230
2236
}
2231
2237
}
@@ -3109,6 +3115,7 @@ where
3109
3115
/// [`drain`]: String::drain
3110
3116
#[ stable( feature = "drain" , since = "1.6.0" ) ]
3111
3117
#[ allow( unused_braces) ]
3118
+ // @FIXME Do we need to use DEFAULT_COOP_PREFERRED here?
3112
3119
pub struct Drain < ' a , const COOP_PREFERRED : bool = { DEFAULT_COOP_PREFERRED ! ( ) } >
3113
3120
where
3114
3121
[ ( ) ; core:: alloc:: co_alloc_metadata_num_slots_with_preference :: < Global > ( COOP_PREFERRED ) ] : ,
0 commit comments