@@ -103,6 +103,7 @@ pub struct VecDeque<
103103
104104#[ stable( feature = "rust1" , since = "1.0.0" ) ]
105105impl < T : Clone , A : Allocator + Clone > Clone for VecDeque < T , A > {
106+ #[ track_caller]
106107 fn clone ( & self ) -> Self {
107108 let mut deq = Self :: with_capacity_in ( self . len ( ) , self . allocator ( ) . clone ( ) ) ;
108109 deq. extend ( self . iter ( ) . cloned ( ) ) ;
@@ -113,6 +114,7 @@ impl<T: Clone, A: Allocator + Clone> Clone for VecDeque<T, A> {
113114 ///
114115 /// This method is preferred over simply assigning `source.clone()` to `self`,
115116 /// as it avoids reallocation if possible.
117+ #[ track_caller]
116118 fn clone_from ( & mut self , source : & Self ) {
117119 self . clear ( ) ;
118120 self . extend ( source. iter ( ) . cloned ( ) ) ;
@@ -490,6 +492,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
490492 /// Frobs the head and tail sections around to handle the fact that we
491493 /// just reallocated. Unsafe because it trusts old_capacity.
492494 #[ inline]
495+ #[ track_caller]
493496 unsafe fn handle_capacity_increase ( & mut self , old_capacity : usize ) {
494497 let new_capacity = self . capacity ( ) ;
495498 debug_assert ! ( new_capacity >= old_capacity) ;
@@ -570,6 +573,7 @@ impl<T> VecDeque<T> {
570573 #[ inline]
571574 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
572575 #[ must_use]
576+ #[ track_caller]
573577 pub fn with_capacity ( capacity : usize ) -> VecDeque < T > {
574578 Self :: with_capacity_in ( capacity, Global )
575579 }
@@ -625,6 +629,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
625629 /// let deque: VecDeque<u32> = VecDeque::with_capacity(10);
626630 /// ```
627631 #[ unstable( feature = "allocator_api" , issue = "32838" ) ]
632+ #[ track_caller]
628633 pub fn with_capacity_in ( capacity : usize , alloc : A ) -> VecDeque < T , A > {
629634 VecDeque { head : 0 , len : 0 , buf : RawVec :: with_capacity_in ( capacity, alloc) }
630635 }
@@ -789,6 +794,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
789794 ///
790795 /// [`reserve`]: VecDeque::reserve
791796 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
797+ #[ track_caller]
792798 pub fn reserve_exact ( & mut self , additional : usize ) {
793799 let new_cap = self . len . checked_add ( additional) . expect ( "capacity overflow" ) ;
794800 let old_cap = self . capacity ( ) ;
@@ -818,6 +824,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
818824 /// assert!(buf.capacity() >= 11);
819825 /// ```
820826 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
827+ #[ track_caller]
821828 pub fn reserve ( & mut self , additional : usize ) {
822829 let new_cap = self . len . checked_add ( additional) . expect ( "capacity overflow" ) ;
823830 let old_cap = self . capacity ( ) ;
@@ -949,6 +956,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
949956 /// assert!(buf.capacity() >= 4);
950957 /// ```
951958 #[ stable( feature = "deque_extras_15" , since = "1.5.0" ) ]
959+ #[ track_caller]
952960 pub fn shrink_to_fit ( & mut self ) {
953961 self . shrink_to ( 0 ) ;
954962 }
@@ -974,6 +982,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
974982 /// assert!(buf.capacity() >= 4);
975983 /// ```
976984 #[ stable( feature = "shrink_to" , since = "1.56.0" ) ]
985+ #[ track_caller]
977986 pub fn shrink_to ( & mut self , min_capacity : usize ) {
978987 let target_cap = min_capacity. max ( self . len ) ;
979988
@@ -1739,6 +1748,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
17391748 /// assert_eq!(d.front(), Some(&2));
17401749 /// ```
17411750 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
1751+ #[ track_caller]
17421752 pub fn push_front ( & mut self , value : T ) {
17431753 if self . is_full ( ) {
17441754 self . grow ( ) ;
@@ -1766,6 +1776,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
17661776 /// ```
17671777 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
17681778 #[ rustc_confusables( "push" , "put" , "append" ) ]
1779+ #[ track_caller]
17691780 pub fn push_back ( & mut self , value : T ) {
17701781 if self . is_full ( ) {
17711782 self . grow ( ) ;
@@ -1875,6 +1886,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
18751886 /// assert_eq!(vec_deque, &['a', 'd', 'b', 'c']);
18761887 /// ```
18771888 #[ stable( feature = "deque_extras_15" , since = "1.5.0" ) ]
1889+ #[ track_caller]
18781890 pub fn insert ( & mut self , index : usize , value : T ) {
18791891 assert ! ( index <= self . len( ) , "index out of bounds" ) ;
18801892 if self . is_full ( ) {
@@ -1978,6 +1990,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
19781990 #[ inline]
19791991 #[ must_use = "use `.truncate()` if you don't need the other half" ]
19801992 #[ stable( feature = "split_off" , since = "1.4.0" ) ]
1993+ #[ track_caller]
19811994 pub fn split_off ( & mut self , at : usize ) -> Self
19821995 where
19831996 A : Clone ,
@@ -2044,6 +2057,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
20442057 /// ```
20452058 #[ inline]
20462059 #[ stable( feature = "append" , since = "1.4.0" ) ]
2060+ #[ track_caller]
20472061 pub fn append ( & mut self , other : & mut Self ) {
20482062 if T :: IS_ZST {
20492063 self . len = self . len . checked_add ( other. len ) . expect ( "capacity overflow" ) ;
@@ -2166,6 +2180,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
21662180 // be called in cold paths.
21672181 // This may panic or abort
21682182 #[ inline( never) ]
2183+ #[ track_caller]
21692184 fn grow ( & mut self ) {
21702185 // Extend or possibly remove this assertion when valid use-cases for growing the
21712186 // buffer without it being full emerge
@@ -2204,6 +2219,7 @@ impl<T, A: Allocator> VecDeque<T, A> {
22042219 /// assert_eq!(buf, [5, 10, 101, 102, 103]);
22052220 /// ```
22062221 #[ stable( feature = "vec_resize_with" , since = "1.33.0" ) ]
2222+ #[ track_caller]
22072223 pub fn resize_with ( & mut self , new_len : usize , generator : impl FnMut ( ) -> T ) {
22082224 let len = self . len ;
22092225
@@ -2750,6 +2766,7 @@ impl<T: Clone, A: Allocator> VecDeque<T, A> {
27502766 /// assert_eq!(buf, [5, 10, 20, 20, 20]);
27512767 /// ```
27522768 #[ stable( feature = "deque_extras" , since = "1.16.0" ) ]
2769+ #[ track_caller]
27532770 pub fn resize ( & mut self , new_len : usize , value : T ) {
27542771 if new_len > self . len ( ) {
27552772 let extra = new_len - self . len ( ) ;
@@ -2869,6 +2886,7 @@ impl<T, A: Allocator> IndexMut<usize> for VecDeque<T, A> {
28692886
28702887#[ stable( feature = "rust1" , since = "1.0.0" ) ]
28712888impl < T > FromIterator < T > for VecDeque < T > {
2889+ #[ track_caller]
28722890 fn from_iter < I : IntoIterator < Item = T > > ( iter : I ) -> VecDeque < T > {
28732891 SpecFromIter :: spec_from_iter ( iter. into_iter ( ) )
28742892 }
@@ -2908,16 +2926,19 @@ impl<'a, T, A: Allocator> IntoIterator for &'a mut VecDeque<T, A> {
29082926
29092927#[ stable( feature = "rust1" , since = "1.0.0" ) ]
29102928impl < T , A : Allocator > Extend < T > for VecDeque < T , A > {
2929+ #[ track_caller]
29112930 fn extend < I : IntoIterator < Item = T > > ( & mut self , iter : I ) {
29122931 <Self as SpecExtend < T , I :: IntoIter > >:: spec_extend ( self , iter. into_iter ( ) ) ;
29132932 }
29142933
29152934 #[ inline]
2935+ #[ track_caller]
29162936 fn extend_one ( & mut self , elem : T ) {
29172937 self . push_back ( elem) ;
29182938 }
29192939
29202940 #[ inline]
2941+ #[ track_caller]
29212942 fn extend_reserve ( & mut self , additional : usize ) {
29222943 self . reserve ( additional) ;
29232944 }
@@ -2933,16 +2954,19 @@ impl<T, A: Allocator> Extend<T> for VecDeque<T, A> {
29332954
29342955#[ stable( feature = "extend_ref" , since = "1.2.0" ) ]
29352956impl < ' a , T : ' a + Copy , A : Allocator > Extend < & ' a T > for VecDeque < T , A > {
2957+ #[ track_caller]
29362958 fn extend < I : IntoIterator < Item = & ' a T > > ( & mut self , iter : I ) {
29372959 self . spec_extend ( iter. into_iter ( ) ) ;
29382960 }
29392961
29402962 #[ inline]
2963+ #[ track_caller]
29412964 fn extend_one ( & mut self , & elem: & ' a T ) {
29422965 self . push_back ( elem) ;
29432966 }
29442967
29452968 #[ inline]
2969+ #[ track_caller]
29462970 fn extend_reserve ( & mut self , additional : usize ) {
29472971 self . reserve ( additional) ;
29482972 }
@@ -3040,6 +3064,7 @@ impl<T, const N: usize> From<[T; N]> for VecDeque<T> {
30403064 /// let deq2: VecDeque<_> = [1, 2, 3, 4].into();
30413065 /// assert_eq!(deq1, deq2);
30423066 /// ```
3067+ #[ track_caller]
30433068 fn from ( arr : [ T ; N ] ) -> Self {
30443069 let mut deq = VecDeque :: with_capacity ( N ) ;
30453070 let arr = ManuallyDrop :: new ( arr) ;
0 commit comments