@@ -82,19 +82,16 @@ impl<T> Clone for Iter<'_, T> {
8282/// documentation for more.
8383#[ stable( feature = "rust1" , since = "1.0.0" ) ]
8484pub 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 > ,
8985 head : Option < NonNull < Node < T > > > ,
9086 tail : Option < NonNull < Node < T > > > ,
9187 len : usize ,
88+ marker : PhantomData < & ' a mut Node < T > > ,
9289}
9390
9491#[ stable( feature = "collection_debug" , since = "1.17.0" ) ]
9592impl < T : fmt:: Debug > fmt:: Debug for IterMut < ' _ , T > {
9693 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 ( )
9895 }
9996}
10097
@@ -493,7 +490,7 @@ impl<T> LinkedList<T> {
493490 #[ inline]
494491 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
495492 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 }
497494 }
498495
499496 /// Provides a cursor at the front element.
0 commit comments