@@ -82,19 +82,16 @@ impl<T> Clone for Iter<'_, T> {
82
82
/// documentation for more.
83
83
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
84
84
pub struct IterMut < ' a , T : ' a > {
85
- // We do *not* exclusively own the entire list here, references to node's `element`
86
- // have been handed out by the iterator! So be careful when using this; the methods
87
- // called must be aware that there can be aliasing pointers to `element`.
88
- list : & ' a mut LinkedList < T > ,
89
85
head : Option < NonNull < Node < T > > > ,
90
86
tail : Option < NonNull < Node < T > > > ,
91
87
len : usize ,
88
+ marker : PhantomData < & ' a mut Node < T > > ,
92
89
}
93
90
94
91
#[ stable( feature = "collection_debug" , since = "1.17.0" ) ]
95
92
impl < T : fmt:: Debug > fmt:: Debug for IterMut < ' _ , T > {
96
93
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
97
- f. debug_tuple ( "IterMut" ) . field ( & self . list ) . field ( & self . len ) . finish ( )
94
+ f. debug_tuple ( "IterMut" ) . field ( & self . len ) . finish ( )
98
95
}
99
96
}
100
97
@@ -493,7 +490,7 @@ impl<T> LinkedList<T> {
493
490
#[ inline]
494
491
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
495
492
pub fn iter_mut ( & mut self ) -> IterMut < ' _ , T > {
496
- IterMut { head : self . head , tail : self . tail , len : self . len , list : self }
493
+ IterMut { head : self . head , tail : self . tail , len : self . len , marker : PhantomData }
497
494
}
498
495
499
496
/// Provides a cursor at the front element.
0 commit comments