@@ -767,6 +767,7 @@ impl<T, A: Allocator> Vec<T, A> {
767767 /// assert!(vec.capacity() >= 11);
768768 /// ```
769769 #[ doc( alias = "realloc" ) ]
770+ #[ track_caller]
770771 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
771772 pub fn reserve ( & mut self , additional : usize ) {
772773 self . buf . reserve ( self . len , additional) ;
@@ -793,6 +794,7 @@ impl<T, A: Allocator> Vec<T, A> {
793794 /// assert!(vec.capacity() >= 11);
794795 /// ```
795796 #[ doc( alias = "realloc" ) ]
797+ #[ track_caller]
796798 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
797799 pub fn reserve_exact ( & mut self , additional : usize ) {
798800 self . buf . reserve_exact ( self . len , additional) ;
@@ -893,6 +895,7 @@ impl<T, A: Allocator> Vec<T, A> {
893895 /// assert!(vec.capacity() >= 3);
894896 /// ```
895897 #[ doc( alias = "realloc" ) ]
898+ #[ track_caller]
896899 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
897900 pub fn shrink_to_fit ( & mut self ) {
898901 // The capacity is never less than the length, and there's nothing to do when
@@ -923,6 +926,7 @@ impl<T, A: Allocator> Vec<T, A> {
923926 /// assert!(vec.capacity() >= 3);
924927 /// ```
925928 #[ doc( alias = "realloc" ) ]
929+ #[ track_caller]
926930 #[ unstable( feature = "shrink_to" , reason = "new API" , issue = "56431" ) ]
927931 pub fn shrink_to ( & mut self , min_capacity : usize ) {
928932 if self . capacity ( ) > min_capacity {
@@ -954,6 +958,7 @@ impl<T, A: Allocator> Vec<T, A> {
954958 /// let slice = vec.into_boxed_slice();
955959 /// assert_eq!(slice.into_vec().capacity(), 3);
956960 /// ```
961+ #[ track_caller]
957962 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
958963 pub fn into_boxed_slice ( mut self ) -> Box < [ T ] , A > {
959964 unsafe {
@@ -1620,6 +1625,7 @@ impl<T, A: Allocator> Vec<T, A> {
16201625 /// assert_eq!(vec, [1, 2, 3]);
16211626 /// ```
16221627 #[ inline]
1628+ #[ track_caller]
16231629 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
16241630 pub fn push ( & mut self , value : T ) {
16251631 // This will panic or abort if we would allocate > isize::MAX bytes
@@ -1673,6 +1679,7 @@ impl<T, A: Allocator> Vec<T, A> {
16731679 /// assert_eq!(vec2, []);
16741680 /// ```
16751681 #[ inline]
1682+ #[ track_caller]
16761683 #[ stable( feature = "append" , since = "1.4.0" ) ]
16771684 pub fn append ( & mut self , other : & mut Self ) {
16781685 unsafe {
@@ -1683,6 +1690,7 @@ impl<T, A: Allocator> Vec<T, A> {
16831690
16841691 /// Appends elements to `Self` from other buffer.
16851692 #[ inline]
1693+ #[ track_caller]
16861694 unsafe fn append_elements ( & mut self , other : * const [ T ] ) {
16871695 let count = unsafe { ( * other) . len ( ) } ;
16881696 self . reserve ( count) ;
@@ -2106,6 +2114,7 @@ impl<T: Clone, A: Allocator> Vec<T, A> {
21062114 /// ```
21072115 ///
21082116 /// [`extend`]: Vec::extend
2117+ #[ track_caller]
21092118 #[ stable( feature = "vec_extend_from_slice" , since = "1.6.0" ) ]
21102119 pub fn extend_from_slice ( & mut self , other : & [ T ] ) {
21112120 self . spec_extend ( other. iter ( ) )
@@ -2183,6 +2192,7 @@ impl<T, F: FnMut() -> T> ExtendWith<T> for ExtendFunc<F> {
21832192
21842193impl < T , A : Allocator > Vec < T , A > {
21852194 /// Extend the vector by `n` values, using the given generator.
2195+ #[ track_caller]
21862196 fn extend_with < E : ExtendWith < T > > ( & mut self , n : usize , mut value : E ) {
21872197 self . reserve ( n) ;
21882198
@@ -2397,6 +2407,7 @@ impl<T, I: SliceIndex<[T]>, A: Allocator> IndexMut<I> for Vec<T, A> {
23972407#[ stable( feature = "rust1" , since = "1.0.0" ) ]
23982408impl < T > FromIterator < T > for Vec < T > {
23992409 #[ inline]
2410+ #[ track_caller]
24002411 fn from_iter < I : IntoIterator < Item = T > > ( iter : I ) -> Vec < T > {
24012412 <Self as SpecFromIter < T , I :: IntoIter > >:: from_iter ( iter. into_iter ( ) )
24022413 }
@@ -2485,6 +2496,7 @@ impl<T, A: Allocator> Extend<T> for Vec<T, A> {
24852496impl < T , A : Allocator > Vec < T , A > {
24862497 // leaf method to which various SpecFrom/SpecExtend implementations delegate when
24872498 // they have no further optimizations to apply
2499+ #[ track_caller]
24882500 fn extend_desugared < I : Iterator < Item = T > > ( & mut self , mut iterator : I ) {
24892501 // This is the case for a general iterator.
24902502 //
@@ -2616,18 +2628,21 @@ impl<T, A: Allocator> Vec<T, A> {
26162628/// append the entire slice at once.
26172629///
26182630/// [`copy_from_slice`]: slice::copy_from_slice
2631+ #[ track_caller]
26192632#[ stable( feature = "extend_ref" , since = "1.2.0" ) ]
26202633impl < ' a , T : Copy + ' a , A : Allocator + ' a > Extend < & ' a T > for Vec < T , A > {
26212634 fn extend < I : IntoIterator < Item = & ' a T > > ( & mut self , iter : I ) {
26222635 self . spec_extend ( iter. into_iter ( ) )
26232636 }
26242637
26252638 #[ inline]
2639+ #[ track_caller]
26262640 fn extend_one ( & mut self , & item: & ' a T ) {
26272641 self . push ( item) ;
26282642 }
26292643
26302644 #[ inline]
2645+ #[ track_caller]
26312646 fn extend_reserve ( & mut self , additional : usize ) {
26322647 self . reserve ( additional) ;
26332648 }
@@ -2792,7 +2807,7 @@ impl<T, A: Allocator, const N: usize> TryFrom<Vec<T, A>> for [T; N] {
27922807 /// # Examples
27932808 ///
27942809 /// ```
2795- /// use std::convert::TryInto;
2810+ /// use std::convert::TryInto;k
27962811 /// assert_eq!(vec![1, 2, 3].try_into(), Ok([1, 2, 3]));
27972812 /// assert_eq!(<Vec<i32>>::new().try_into(), Ok([]));
27982813 /// ```
0 commit comments