@@ -107,6 +107,7 @@ pub struct VecDeque<
107107
108108#[ stable( feature = "rust1" , since = "1.0.0" ) ]
109109impl < T : Clone , A : Allocator + Clone > Clone for VecDeque < T , A > {
110+ #[ track_caller]
110111 fn clone ( & self ) -> Self {
111112 let mut deq = Self :: with_capacity_in ( self . len ( ) , self . allocator ( ) . clone ( ) ) ;
112113 deq. extend ( self . iter ( ) . cloned ( ) ) ;
@@ -117,6 +118,7 @@ impl<T: Clone, A: Allocator + Clone> Clone for VecDeque<T, A> {
117118 ///
118119 /// This method is preferred over simply assigning `source.clone()` to `self`,
119120 /// as it avoids reallocation if possible.
121+ #[ track_caller]
120122 fn clone_from ( & mut self , source : & Self ) {
121123 self . clear ( ) ;
122124 self . extend ( source. iter ( ) . cloned ( ) ) ;
@@ -480,6 +482,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
480482 /// Frobs the head and tail sections around to handle the fact that we
481483 /// just reallocated. Unsafe because it trusts old_capacity.
482484 #[ inline]
485+ #[ track_caller]
483486 unsafe fn handle_capacity_increase ( & mut self , old_capacity : usize ) {
484487 let new_capacity = self . capacity ( ) ;
485488 debug_assert ! ( new_capacity >= old_capacity) ;
@@ -560,6 +563,7 @@ impl<T> VecDeque<T> {
560563 #[ inline]
561564 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
562565 #[ must_use]
566+ #[ track_caller]
563567 pub fn with_capacity ( capacity : usize ) -> VecDeque < T > {
564568 Self :: with_capacity_in ( capacity, Global )
565569 }
@@ -615,6 +619,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
615619 /// let deque: VecDeque<u32> = VecDeque::with_capacity(10);
616620 /// ```
617621 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
622+ #[ track_caller]
618623 pub fn with_capacity_in ( capacity : usize , alloc : A ) -> VecDeque < T , A > {
619624 VecDeque { head : 0 , len : 0 , buf : RawVec :: with_capacity_in ( capacity, alloc) }
620625 }
@@ -779,6 +784,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
779784 ///
780785 /// [`reserve`]: VecDeque::reserve
781786 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
787+ #[ track_caller]
782788 pub fn reserve_exact ( & mut self , additional : usize ) {
783789 let new_cap = self . len . checked_add ( additional) . expect ( "capacity overflow" ) ;
784790 let old_cap = self . capacity ( ) ;
@@ -808,6 +814,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
808814 /// assert!(buf.capacity() >= 11);
809815 /// ```
810816 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
817+ #[ track_caller]
811818 pub fn reserve ( & mut self , additional : usize ) {
812819 let new_cap = self . len . checked_add ( additional) . expect ( "capacity overflow" ) ;
813820 let old_cap = self . capacity ( ) ;
@@ -939,6 +946,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
939946 /// assert!(buf.capacity() >= 4);
940947 /// ```
941948 #[ stable( feature = "deque_extras_15" , since = "1.5.0" ) ]
949+ #[ track_caller]
942950 pub fn shrink_to_fit ( & mut self ) {
943951 self . shrink_to ( 0 ) ;
944952 }
@@ -964,6 +972,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
964972 /// assert!(buf.capacity() >= 4);
965973 /// ```
966974 #[ stable( feature = "shrink_to" , since = "1.56.0" ) ]
975+ #[ track_caller]
967976 pub fn shrink_to ( & mut self , min_capacity : usize ) {
968977 let target_cap = min_capacity. max ( self . len ) ;
969978
@@ -1729,6 +1738,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
17291738 /// assert_eq!(d.front(), Some(&2));
17301739 /// ```
17311740 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1741+ #[ track_caller]
17321742 pub fn push_front ( & mut self , value : T ) {
17331743 if self . is_full ( ) {
17341744 self . grow ( ) ;
@@ -1756,6 +1766,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
17561766 /// ```
17571767 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
17581768 #[ rustc_confusables( "push" , "put" , "append" ) ]
1769+ #[ track_caller]
17591770 pub fn push_back ( & mut self , value : T ) {
17601771 if self . is_full ( ) {
17611772 self . grow ( ) ;
@@ -1865,6 +1876,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
18651876 /// assert_eq!(vec_deque, &['a', 'd', 'b', 'c']);
18661877 /// ```
18671878 #[ stable( feature = "deque_extras_15" , since = "1.5.0" ) ]
1879+ #[ track_caller]
18681880 pub fn insert ( & mut self , index : usize , value : T ) {
18691881 assert ! ( index <= self . len( ) , "index out of bounds" ) ;
18701882 if self . is_full ( ) {
@@ -1968,6 +1980,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
19681980 #[ inline]
19691981 #[ must_use = "use `.truncate()` if you don't need the other half" ]
19701982 #[ stable( feature = "split_off" , since = "1.4.0" ) ]
1983+ #[ track_caller]
19711984 pub fn split_off ( & mut self , at : usize ) -> Self
19721985 where
19731986 A : Clone ,
@@ -2034,6 +2047,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
20342047 /// ```
20352048 #[ inline]
20362049 #[ stable( feature = "append" , since = "1.4.0" ) ]
2050+ #[ track_caller]
20372051 pub fn append ( & mut self , other : & mut Self ) {
20382052 if T :: IS_ZST {
20392053 self . len = self . len . checked_add ( other. len ) . expect ( "capacity overflow" ) ;
@@ -2156,6 +2170,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
21562170 // be called in cold paths.
21572171 // This may panic or abort
21582172 #[ inline( never) ]
2173+ #[ track_caller]
21592174 fn grow ( & mut self ) {
21602175 // Extend or possibly remove this assertion when valid use-cases for growing the
21612176 // buffer without it being full emerge
@@ -2194,6 +2209,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
21942209 /// assert_eq!(buf, [5, 10, 101, 102, 103]);
21952210 /// ```
21962211 #[ stable( feature = "vec_resize_with" , since = "1.33.0" ) ]
2212+ #[ track_caller]
21972213 pub fn resize_with ( & mut self , new_len : usize , generator : impl FnMut ( ) -> T ) {
21982214 let len = self . len ;
21992215
@@ -2740,6 +2756,7 @@ impl<T: Clone, A: Allocator> VecDeque<T, A> {
27402756 /// assert_eq!(buf, [5, 10, 20, 20, 20]);
27412757 /// ```
27422758 #[ stable( feature = "deque_extras" , since = "1.16.0" ) ]
2759+ #[ track_caller]
27432760 pub fn resize ( & mut self , new_len : usize , value : T ) {
27442761 if new_len > self . len ( ) {
27452762 let extra = new_len - self . len ( ) ;
@@ -2859,6 +2876,7 @@ impl<T, A: Allocator> IndexMut<usize> for VecDeque<T, A> {
28592876
28602877#[ stable( feature = "rust1" , since = "1.0.0" ) ]
28612878impl < T > FromIterator < T > for VecDeque < T > {
2879+ #[ track_caller]
28622880 fn from_iter < I : IntoIterator < Item = T > > ( iter : I ) -> VecDeque < T > {
28632881 SpecFromIter :: spec_from_iter ( iter. into_iter ( ) )
28642882 }
@@ -2898,33 +2916,39 @@ impl<'a, T, A: Allocator> IntoIterator for &'a mut VecDeque<T, A> {
28982916
28992917#[ stable( feature = "rust1" , since = "1.0.0" ) ]
29002918impl < T , A : Allocator > Extend < T > for VecDeque < T , A > {
2919+ #[ track_caller]
29012920 fn extend < I : IntoIterator < Item = T > > ( & mut self , iter : I ) {
29022921 <Self as SpecExtend < T , I :: IntoIter > >:: spec_extend ( self , iter. into_iter ( ) ) ;
29032922 }
29042923
29052924 #[ inline]
2925+ #[ track_caller]
29062926 fn extend_one ( & mut self , elem : T ) {
29072927 self . push_back ( elem) ;
29082928 }
29092929
29102930 #[ inline]
2931+ #[ track_caller]
29112932 fn extend_reserve ( & mut self , additional : usize ) {
29122933 self . reserve ( additional) ;
29132934 }
29142935}
29152936
29162937#[ stable( feature = "extend_ref" , since = "1.2.0" ) ]
29172938impl < ' a , T : ' a + Copy , A : Allocator > Extend < & ' a T > for VecDeque < T , A > {
2939+ #[ track_caller]
29182940 fn extend < I : IntoIterator < Item = & ' a T > > ( & mut self , iter : I ) {
29192941 self . spec_extend ( iter. into_iter ( ) ) ;
29202942 }
29212943
29222944 #[ inline]
2945+ #[ track_caller]
29232946 fn extend_one ( & mut self , & elem: & ' a T ) {
29242947 self . push_back ( elem) ;
29252948 }
29262949
29272950 #[ inline]
2951+ #[ track_caller]
29282952 fn extend_reserve ( & mut self , additional : usize ) {
29292953 self . reserve ( additional) ;
29302954 }
@@ -3014,6 +3038,7 @@ impl<T, const N: usize> From<[T; N]> for VecDeque<T> {
30143038 /// let deq2: VecDeque<_> = [1, 2, 3, 4].into();
30153039 /// assert_eq!(deq1, deq2);
30163040 /// ```
3041+ #[ track_caller]
30173042 fn from ( arr : [ T ; N ] ) -> Self {
30183043 let mut deq = VecDeque :: with_capacity ( N ) ;
30193044 let arr = ManuallyDrop :: new ( arr) ;
0 commit comments