@@ -1105,6 +1105,7 @@ impl String {
1105
1105
/// ```
1106
1106
#[ cfg( not( no_global_oom_handling) ) ]
1107
1107
#[ inline]
1108
+ #[ track_caller]
1108
1109
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1109
1110
#[ rustc_confusables( "append" , "push" ) ]
1110
1111
#[ rustc_diagnostic_item = "string_push_str" ]
@@ -1135,6 +1136,7 @@ impl String {
1135
1136
/// ```
1136
1137
#[ cfg( not( no_global_oom_handling) ) ]
1137
1138
#[ stable( feature = "string_extend_from_within" , since = "1.87.0" ) ]
1139
+ #[ track_caller]
1138
1140
pub fn extend_from_within < R > ( & mut self , src : R )
1139
1141
where
1140
1142
R : RangeBounds < usize > ,
@@ -1206,6 +1208,7 @@ impl String {
1206
1208
/// ```
1207
1209
#[ cfg( not( no_global_oom_handling) ) ]
1208
1210
#[ inline]
1211
+ #[ track_caller]
1209
1212
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1210
1213
pub fn reserve ( & mut self , additional : usize ) {
1211
1214
self . vec . reserve ( additional)
@@ -1257,6 +1260,7 @@ impl String {
1257
1260
#[ cfg( not( no_global_oom_handling) ) ]
1258
1261
#[ inline]
1259
1262
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1263
+ #[ track_caller]
1260
1264
pub fn reserve_exact ( & mut self , additional : usize ) {
1261
1265
self . vec . reserve_exact ( additional)
1262
1266
}
@@ -1352,6 +1356,7 @@ impl String {
1352
1356
/// ```
1353
1357
#[ cfg( not( no_global_oom_handling) ) ]
1354
1358
#[ inline]
1359
+ #[ track_caller]
1355
1360
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1356
1361
pub fn shrink_to_fit ( & mut self ) {
1357
1362
self . vec . shrink_to_fit ( )
@@ -1379,6 +1384,7 @@ impl String {
1379
1384
/// ```
1380
1385
#[ cfg( not( no_global_oom_handling) ) ]
1381
1386
#[ inline]
1387
+ #[ track_caller]
1382
1388
#[ stable( feature = "shrink_to" , since = "1.56.0" ) ]
1383
1389
pub fn shrink_to ( & mut self , min_capacity : usize ) {
1384
1390
self . vec . shrink_to ( min_capacity)
@@ -1400,6 +1406,7 @@ impl String {
1400
1406
#[ cfg( not( no_global_oom_handling) ) ]
1401
1407
#[ inline]
1402
1408
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1409
+ #[ track_caller]
1403
1410
pub fn push ( & mut self , ch : char ) {
1404
1411
let len = self . len ( ) ;
1405
1412
let ch_len = ch. len_utf8 ( ) ;
@@ -1889,6 +1896,7 @@ impl String {
1889
1896
/// ```
1890
1897
#[ cfg( not( no_global_oom_handling) ) ]
1891
1898
#[ inline]
1899
+ #[ track_caller]
1892
1900
#[ stable( feature = "string_split_off" , since = "1.16.0" ) ]
1893
1901
#[ must_use = "use `.truncate()` if you don't need the other half" ]
1894
1902
pub fn split_off ( & mut self , at : usize ) -> String {
@@ -2101,6 +2109,7 @@ impl String {
2101
2109
#[ stable( feature = "box_str" , since = "1.4.0" ) ]
2102
2110
#[ must_use = "`self` will be dropped if the result is not used" ]
2103
2111
#[ inline]
2112
+ #[ track_caller]
2104
2113
pub fn into_boxed_str ( self ) -> Box < str > {
2105
2114
let slice = self . vec . into_boxed_slice ( ) ;
2106
2115
unsafe { from_boxed_utf8_unchecked ( slice) }
@@ -2288,6 +2297,7 @@ impl Error for FromUtf16Error {
2288
2297
#[ cfg( not( no_global_oom_handling) ) ]
2289
2298
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2290
2299
impl Clone for String {
2300
+ #[ track_caller]
2291
2301
fn clone ( & self ) -> Self {
2292
2302
String { vec : self . vec . clone ( ) }
2293
2303
}
@@ -2296,6 +2306,7 @@ impl Clone for String {
2296
2306
///
2297
2307
/// This method is preferred over simply assigning `source.clone()` to `self`,
2298
2308
/// as it avoids reallocation if possible.
2309
+ #[ track_caller]
2299
2310
fn clone_from ( & mut self , source : & Self ) {
2300
2311
self . vec . clone_from ( & source. vec ) ;
2301
2312
}
@@ -2469,11 +2480,14 @@ impl<'a> Extend<Cow<'a, str>> for String {
2469
2480
#[ cfg( not( no_global_oom_handling) ) ]
2470
2481
#[ unstable( feature = "ascii_char" , issue = "110998" ) ]
2471
2482
impl Extend < core:: ascii:: Char > for String {
2483
+ #[ inline]
2484
+ #[ track_caller]
2472
2485
fn extend < I : IntoIterator < Item = core:: ascii:: Char > > ( & mut self , iter : I ) {
2473
2486
self . vec . extend ( iter. into_iter ( ) . map ( |c| c. to_u8 ( ) ) ) ;
2474
2487
}
2475
2488
2476
2489
#[ inline]
2490
+ #[ track_caller]
2477
2491
fn extend_one ( & mut self , c : core:: ascii:: Char ) {
2478
2492
self . vec . push ( c. to_u8 ( ) ) ;
2479
2493
}
@@ -2482,11 +2496,14 @@ impl Extend<core::ascii::Char> for String {
2482
2496
#[ cfg( not( no_global_oom_handling) ) ]
2483
2497
#[ unstable( feature = "ascii_char" , issue = "110998" ) ]
2484
2498
impl < ' a > Extend < & ' a core:: ascii:: Char > for String {
2499
+ #[ inline]
2500
+ #[ track_caller]
2485
2501
fn extend < I : IntoIterator < Item = & ' a core:: ascii:: Char > > ( & mut self , iter : I ) {
2486
2502
self . extend ( iter. into_iter ( ) . cloned ( ) ) ;
2487
2503
}
2488
2504
2489
2505
#[ inline]
2506
+ #[ track_caller]
2490
2507
fn extend_one ( & mut self , c : & ' a core:: ascii:: Char ) {
2491
2508
self . vec . push ( c. to_u8 ( ) ) ;
2492
2509
}
0 commit comments