@@ -1480,13 +1480,19 @@ where
14801480 where
14811481 F : FnMut ( char ) -> bool ,
14821482 {
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 > ,
14851488 idx : usize ,
14861489 del_bytes : usize ,
14871490 }
14881491
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+ {
14901496 fn drop ( & mut self ) {
14911497 let new_len = self . idx - self . del_bytes ;
14921498 debug_assert ! ( new_len <= self . s. len( ) ) ;
@@ -1783,7 +1789,7 @@ where
17831789 /// assert_eq!(s, "");
17841790 /// ```
17851791 #[ 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 >
17871793 where
17881794 R : RangeBounds < usize > ,
17891795 {
@@ -2216,16 +2222,16 @@ where [(); core::alloc::co_alloc_metadata_num_slots_with_preference::<Global>(CO
22162222
22172223#[ cfg( not( no_global_oom_handling) ) ]
22182224#[ 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 >
22202226where
22212227 [ ( ) ; core:: alloc:: co_alloc_metadata_num_slots_with_preference :: < Global > ( COOP_PREFERRED ) ] : ,
22222228{
2223- fn extend < I : IntoIterator < Item = String > > ( & mut self , iter : I ) {
2229+ fn extend < I : IntoIterator < Item = String < COOP_PREFERRED > > > ( & mut self , iter : I ) {
22242230 iter. into_iter ( ) . for_each ( move |s| self . push_str ( & s) ) ;
22252231 }
22262232
22272233 #[ inline]
2228- fn extend_one ( & mut self , s : String ) {
2234+ fn extend_one ( & mut self , s : String < COOP_PREFERRED > ) {
22292235 self . push_str ( & s) ;
22302236 }
22312237}
@@ -3109,6 +3115,7 @@ where
31093115/// [`drain`]: String::drain
31103116#[ stable( feature = "drain" , since = "1.6.0" ) ]
31113117#[ allow( unused_braces) ]
3118+ // @FIXME Do we need to use DEFAULT_COOP_PREFERRED here?
31123119pub struct Drain < ' a , const COOP_PREFERRED : bool = { DEFAULT_COOP_PREFERRED ! ( ) } >
31133120where
31143121 [ ( ) ; core:: alloc:: co_alloc_metadata_num_slots_with_preference :: < Global > ( COOP_PREFERRED ) ] : ,
0 commit comments