@@ -769,6 +769,7 @@ impl<T, A: Allocator> Vec<T, A> {
769
769
/// assert!(vec.capacity() >= 11);
770
770
/// ```
771
771
#[ doc( alias = "realloc" ) ]
772
+ #[ track_caller]
772
773
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
773
774
pub fn reserve ( & mut self , additional : usize ) {
774
775
self . buf . reserve ( self . len , additional) ;
@@ -795,6 +796,7 @@ impl<T, A: Allocator> Vec<T, A> {
795
796
/// assert!(vec.capacity() >= 11);
796
797
/// ```
797
798
#[ doc( alias = "realloc" ) ]
799
+ #[ track_caller]
798
800
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
799
801
pub fn reserve_exact ( & mut self , additional : usize ) {
800
802
self . buf . reserve_exact ( self . len , additional) ;
@@ -895,6 +897,7 @@ impl<T, A: Allocator> Vec<T, A> {
895
897
/// assert!(vec.capacity() >= 3);
896
898
/// ```
897
899
#[ doc( alias = "realloc" ) ]
900
+ #[ track_caller]
898
901
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
899
902
pub fn shrink_to_fit ( & mut self ) {
900
903
// The capacity is never less than the length, and there's nothing to do when
@@ -925,6 +928,7 @@ impl<T, A: Allocator> Vec<T, A> {
925
928
/// assert!(vec.capacity() >= 3);
926
929
/// ```
927
930
#[ doc( alias = "realloc" ) ]
931
+ #[ track_caller]
928
932
#[ unstable( feature = "shrink_to" , reason = "new API" , issue = "56431" ) ]
929
933
pub fn shrink_to ( & mut self , min_capacity : usize ) {
930
934
if self . capacity ( ) > min_capacity {
@@ -956,6 +960,7 @@ impl<T, A: Allocator> Vec<T, A> {
956
960
/// let slice = vec.into_boxed_slice();
957
961
/// assert_eq!(slice.into_vec().capacity(), 3);
958
962
/// ```
963
+ #[ track_caller]
959
964
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
960
965
pub fn into_boxed_slice ( mut self ) -> Box < [ T ] , A > {
961
966
unsafe {
@@ -1539,6 +1544,7 @@ impl<T, A: Allocator> Vec<T, A> {
1539
1544
/// assert_eq!(vec, [1, 2, 3]);
1540
1545
/// ```
1541
1546
#[ inline]
1547
+ #[ track_caller]
1542
1548
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1543
1549
pub fn push ( & mut self , value : T ) {
1544
1550
// This will panic or abort if we would allocate > isize::MAX bytes
@@ -1592,6 +1598,7 @@ impl<T, A: Allocator> Vec<T, A> {
1592
1598
/// assert_eq!(vec2, []);
1593
1599
/// ```
1594
1600
#[ inline]
1601
+ #[ track_caller]
1595
1602
#[ stable( feature = "append" , since = "1.4.0" ) ]
1596
1603
pub fn append ( & mut self , other : & mut Self ) {
1597
1604
unsafe {
@@ -1602,6 +1609,7 @@ impl<T, A: Allocator> Vec<T, A> {
1602
1609
1603
1610
/// Appends elements to `Self` from other buffer.
1604
1611
#[ inline]
1612
+ #[ track_caller]
1605
1613
unsafe fn append_elements ( & mut self , other : * const [ T ] ) {
1606
1614
let count = unsafe { ( * other) . len ( ) } ;
1607
1615
self . reserve ( count) ;
@@ -2009,6 +2017,7 @@ impl<T: Clone, A: Allocator> Vec<T, A> {
2009
2017
/// ```
2010
2018
///
2011
2019
/// [`extend`]: Vec::extend
2020
+ #[ track_caller]
2012
2021
#[ stable( feature = "vec_extend_from_slice" , since = "1.6.0" ) ]
2013
2022
pub fn extend_from_slice ( & mut self , other : & [ T ] ) {
2014
2023
self . spec_extend ( other. iter ( ) )
@@ -2086,6 +2095,7 @@ impl<T, F: FnMut() -> T> ExtendWith<T> for ExtendFunc<F> {
2086
2095
2087
2096
impl < T , A : Allocator > Vec < T , A > {
2088
2097
/// Extend the vector by `n` values, using the given generator.
2098
+ #[ track_caller]
2089
2099
fn extend_with < E : ExtendWith < T > > ( & mut self , n : usize , mut value : E ) {
2090
2100
self . reserve ( n) ;
2091
2101
@@ -2298,6 +2308,7 @@ impl<T, I: SliceIndex<[T]>, A: Allocator> IndexMut<I> for Vec<T, A> {
2298
2308
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
2299
2309
impl < T > FromIterator < T > for Vec < T > {
2300
2310
#[ inline]
2311
+ #[ track_caller]
2301
2312
fn from_iter < I : IntoIterator < Item = T > > ( iter : I ) -> Vec < T > {
2302
2313
<Self as SpecFromIter < T , I :: IntoIter > >:: from_iter ( iter. into_iter ( ) )
2303
2314
}
@@ -2386,6 +2397,7 @@ impl<T, A: Allocator> Extend<T> for Vec<T, A> {
2386
2397
impl < T , A : Allocator > Vec < T , A > {
2387
2398
// leaf method to which various SpecFrom/SpecExtend implementations delegate when
2388
2399
// they have no further optimizations to apply
2400
+ #[ track_caller]
2389
2401
fn extend_desugared < I : Iterator < Item = T > > ( & mut self , mut iterator : I ) {
2390
2402
// This is the case for a general iterator.
2391
2403
//
@@ -2517,18 +2529,22 @@ impl<T, A: Allocator> Vec<T, A> {
2517
2529
/// append the entire slice at once.
2518
2530
///
2519
2531
/// [`copy_from_slice`]: ../../std/primitive.slice.html#method.copy_from_slice
2532
+ /// [`copy_from_slice`]: slice::copy_from_slice
2520
2533
#[ stable( feature = "extend_ref" , since = "1.2.0" ) ]
2521
2534
impl < ' a , T : Copy + ' a , A : Allocator + ' a > Extend < & ' a T > for Vec < T , A > {
2535
+ #[ track_caller]
2522
2536
fn extend < I : IntoIterator < Item = & ' a T > > ( & mut self , iter : I ) {
2523
2537
self . spec_extend ( iter. into_iter ( ) )
2524
2538
}
2525
2539
2526
2540
#[ inline]
2541
+ #[ track_caller]
2527
2542
fn extend_one ( & mut self , & item: & ' a T ) {
2528
2543
self . push ( item) ;
2529
2544
}
2530
2545
2531
2546
#[ inline]
2547
+ #[ track_caller]
2532
2548
fn extend_reserve ( & mut self , additional : usize ) {
2533
2549
self . reserve ( additional) ;
2534
2550
}
0 commit comments