@@ -1105,6 +1105,7 @@ impl String {
11051105 /// ```
11061106 #[ cfg( not( no_global_oom_handling) ) ]
11071107 #[ inline]
1108+ #[ track_caller]
11081109 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
11091110 #[ rustc_confusables( "append" , "push" ) ]
11101111 #[ rustc_diagnostic_item = "string_push_str" ]
@@ -1135,6 +1136,7 @@ impl String {
11351136 /// ```
11361137 #[ cfg( not( no_global_oom_handling) ) ]
11371138 #[ stable( feature = "string_extend_from_within" , since = "1.87.0" ) ]
1139+ #[ track_caller]
11381140 pub fn extend_from_within < R > ( & mut self , src : R )
11391141 where
11401142 R : RangeBounds < usize > ,
@@ -1206,6 +1208,7 @@ impl String {
12061208 /// ```
12071209 #[ cfg( not( no_global_oom_handling) ) ]
12081210 #[ inline]
1211+ #[ track_caller]
12091212 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
12101213 pub fn reserve ( & mut self , additional : usize ) {
12111214 self . vec . reserve ( additional)
@@ -1257,6 +1260,7 @@ impl String {
12571260 #[ cfg( not( no_global_oom_handling) ) ]
12581261 #[ inline]
12591262 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1263+ #[ track_caller]
12601264 pub fn reserve_exact ( & mut self , additional : usize ) {
12611265 self . vec . reserve_exact ( additional)
12621266 }
@@ -1352,6 +1356,7 @@ impl String {
13521356 /// ```
13531357 #[ cfg( not( no_global_oom_handling) ) ]
13541358 #[ inline]
1359+ #[ track_caller]
13551360 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
13561361 pub fn shrink_to_fit ( & mut self ) {
13571362 self . vec . shrink_to_fit ( )
@@ -1379,6 +1384,7 @@ impl String {
13791384 /// ```
13801385 #[ cfg( not( no_global_oom_handling) ) ]
13811386 #[ inline]
1387+ #[ track_caller]
13821388 #[ stable( feature = "shrink_to" , since = "1.56.0" ) ]
13831389 pub fn shrink_to ( & mut self , min_capacity : usize ) {
13841390 self . vec . shrink_to ( min_capacity)
@@ -1400,6 +1406,7 @@ impl String {
14001406 #[ cfg( not( no_global_oom_handling) ) ]
14011407 #[ inline]
14021408 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1409+ #[ track_caller]
14031410 pub fn push ( & mut self , ch : char ) {
14041411 let len = self . len ( ) ;
14051412 let ch_len = ch. len_utf8 ( ) ;
@@ -1889,6 +1896,7 @@ impl String {
18891896 /// ```
18901897 #[ cfg( not( no_global_oom_handling) ) ]
18911898 #[ inline]
1899+ #[ track_caller]
18921900 #[ stable( feature = "string_split_off" , since = "1.16.0" ) ]
18931901 #[ must_use = "use `.truncate()` if you don't need the other half" ]
18941902 pub fn split_off ( & mut self , at : usize ) -> String {
@@ -2101,6 +2109,7 @@ impl String {
21012109 #[ stable( feature = "box_str" , since = "1.4.0" ) ]
21022110 #[ must_use = "`self` will be dropped if the result is not used" ]
21032111 #[ inline]
2112+ #[ track_caller]
21042113 pub fn into_boxed_str ( self ) -> Box < str > {
21052114 let slice = self . vec . into_boxed_slice ( ) ;
21062115 unsafe { from_boxed_utf8_unchecked ( slice) }
@@ -2288,6 +2297,7 @@ impl Error for FromUtf16Error {
22882297#[ cfg( not( no_global_oom_handling) ) ]
22892298#[ stable( feature = "rust1" , since = "1.0.0" ) ]
22902299impl Clone for String {
2300+ #[ track_caller]
22912301 fn clone ( & self ) -> Self {
22922302 String { vec : self . vec . clone ( ) }
22932303 }
@@ -2296,6 +2306,7 @@ impl Clone for String {
22962306 ///
22972307 /// This method is preferred over simply assigning `source.clone()` to `self`,
22982308 /// as it avoids reallocation if possible.
2309+ #[ track_caller]
22992310 fn clone_from ( & mut self , source : & Self ) {
23002311 self . vec . clone_from ( & source. vec ) ;
23012312 }
@@ -2469,11 +2480,14 @@ impl<'a> Extend<Cow<'a, str>> for String {
24692480#[ cfg( not( no_global_oom_handling) ) ]
24702481#[ unstable( feature = "ascii_char" , issue = "110998" ) ]
24712482impl Extend < core:: ascii:: Char > for String {
2483+ #[ inline]
2484+ #[ track_caller]
24722485 fn extend < I : IntoIterator < Item = core:: ascii:: Char > > ( & mut self , iter : I ) {
24732486 self . vec . extend ( iter. into_iter ( ) . map ( |c| c. to_u8 ( ) ) ) ;
24742487 }
24752488
24762489 #[ inline]
2490+ #[ track_caller]
24772491 fn extend_one ( & mut self , c : core:: ascii:: Char ) {
24782492 self . vec . push ( c. to_u8 ( ) ) ;
24792493 }
@@ -2482,11 +2496,14 @@ impl Extend<core::ascii::Char> for String {
24822496#[ cfg( not( no_global_oom_handling) ) ]
24832497#[ unstable( feature = "ascii_char" , issue = "110998" ) ]
24842498impl < ' a > Extend < & ' a core:: ascii:: Char > for String {
2499+ #[ inline]
2500+ #[ track_caller]
24852501 fn extend < I : IntoIterator < Item = & ' a core:: ascii:: Char > > ( & mut self , iter : I ) {
24862502 self . extend ( iter. into_iter ( ) . cloned ( ) ) ;
24872503 }
24882504
24892505 #[ inline]
2506+ #[ track_caller]
24902507 fn extend_one ( & mut self , c : & ' a core:: ascii:: Char ) {
24912508 self . vec . push ( c. to_u8 ( ) ) ;
24922509 }
0 commit comments