@@ -668,20 +668,7 @@ impl<K: Ord, V> TreeMap<K, V> {
668668 }
669669}
670670
671- /// Note: stage0-specific version that lacks bound on A.
672- #[ cfg( stage0) ]
673- pub struct Entries < ' a , K , V > {
674- stack : Vec < & ' a TreeNode < K , V > > ,
675- // See the comment on MutEntries; this is just to allow
676- // code-sharing (for this immutable-values iterator it *could* very
677- // well be Option<&'a TreeNode<K,V>>).
678- node : * const TreeNode < K , V > ,
679- remaining_min : uint ,
680- remaining_max : uint
681- }
682-
683671/// Lazy forward iterator over a map
684- #[ cfg( not( stage0) ) ]
685672pub struct Entries < ' a , K : ' a , V : ' a > {
686673 stack : Vec < & ' a TreeNode < K , V > > ,
687674 // See the comment on MutEntries; this is just to allow
@@ -692,49 +679,13 @@ pub struct Entries<'a, K:'a, V:'a> {
692679 remaining_max : uint
693680}
694681
695- /// Note: stage0-specific version that lacks bound on A.
696- #[ cfg( stage0) ]
697- pub struct RevEntries < ' a , K , V > {
698- iter : Entries < ' a , K , V > ,
699- }
700-
701682/// Lazy backward iterator over a map
702- #[ cfg( not( stage0) ) ]
703683pub struct RevEntries < ' a , K : ' a , V : ' a > {
704684 iter : Entries < ' a , K , V > ,
705685}
706686
707- /// Note: stage0-specific version that lacks bound on A.
708- #[ cfg( stage0) ]
709- pub struct MutEntries < ' a , K , V > {
710- stack : Vec < & ' a mut TreeNode < K , V > > ,
711- // Unfortunately, we require some unsafe-ness to get around the
712- // fact that we would be storing a reference *into* one of the
713- // nodes in the stack.
714- //
715- // As far as the compiler knows, this would let us invalidate the
716- // reference by assigning a new value to this node's position in
717- // its parent, which would cause this current one to be
718- // deallocated so this reference would be invalid. (i.e. the
719- // compilers complaints are 100% correct.)
720- //
721- // However, as far as you humans reading this code know (or are
722- // about to know, if you haven't read far enough down yet), we are
723- // only reading from the TreeNode.{left,right} fields. the only
724- // thing that is ever mutated is the .value field (although any
725- // actual mutation that happens is done externally, by the
726- // iterator consumer). So, don't be so concerned, rustc, we've got
727- // it under control.
728- //
729- // (This field can legitimately be null.)
730- node : * mut TreeNode < K , V > ,
731- remaining_min : uint ,
732- remaining_max : uint
733- }
734-
735687/// Lazy forward iterator over a map that allows for the mutation of
736688/// the values.
737- #[ cfg( not( stage0) ) ]
738689pub struct MutEntries < ' a , K : ' a , V : ' a > {
739690 stack : Vec < & ' a mut TreeNode < K , V > > ,
740691 // Unfortunately, we require some unsafe-ness to get around the
@@ -761,14 +712,7 @@ pub struct MutEntries<'a, K:'a, V:'a> {
761712 remaining_max : uint
762713}
763714
764- /// Note: stage0-specific version that lacks bound on A.
765- #[ cfg( stage0) ]
766- pub struct RevMutEntries < ' a , K , V > {
767- iter : MutEntries < ' a , K , V > ,
768- }
769-
770715/// Lazy backward iterator over a map
771- #[ cfg( not( stage0) ) ]
772716pub struct RevMutEntries < ' a , K : ' a , V : ' a > {
773717 iter : MutEntries < ' a , K , V > ,
774718}
@@ -1375,84 +1319,38 @@ impl<T: Ord> TreeSet<T> {
13751319 }
13761320}
13771321
1378- /// Note: stage0-specific version that lacks bound on A.
1379- #[ cfg( stage0) ]
1380- pub struct SetItems < ' a , T > {
1381- iter : Entries < ' a , T , ( ) >
1382- }
1383-
13841322/// A lazy forward iterator over a set.
1385- #[ cfg( not( stage0) ) ]
13861323pub struct SetItems < ' a , T : ' a > {
13871324 iter : Entries < ' a , T , ( ) >
13881325}
13891326
1390- /// Note: stage0-specific version that lacks bound on A.
1391- #[ cfg( stage0) ]
1392- pub struct RevSetItems < ' a , T > {
1393- iter : RevEntries < ' a , T , ( ) >
1394- }
1395-
13961327/// A lazy backward iterator over a set.
1397- #[ cfg( not( stage0) ) ]
13981328pub struct RevSetItems < ' a , T : ' a > {
13991329 iter : RevEntries < ' a , T , ( ) >
14001330}
14011331
14021332/// A lazy forward iterator over a set that consumes the set while iterating.
14031333pub type MoveSetItems < T > = iter:: Map < ' static , ( T , ( ) ) , T , MoveEntries < T , ( ) > > ;
14041334
1405- /// Note: stage0-specific version that lacks bound on A.
1406- #[ cfg( stage0) ]
1407- pub struct DifferenceItems < ' a , T > {
1408- a : Peekable < & ' a T , SetItems < ' a , T > > ,
1409- b : Peekable < & ' a T , SetItems < ' a , T > > ,
1410- }
1411-
14121335/// A lazy iterator producing elements in the set difference (in-order).
1413- #[ cfg( not( stage0) ) ]
14141336pub struct DifferenceItems < ' a , T : ' a > {
14151337 a : Peekable < & ' a T , SetItems < ' a , T > > ,
14161338 b : Peekable < & ' a T , SetItems < ' a , T > > ,
14171339}
14181340
1419- /// Note: stage0-specific version that lacks bound on A.
1420- #[ cfg( stage0) ]
1421- pub struct SymDifferenceItems < ' a , T > {
1422- a : Peekable < & ' a T , SetItems < ' a , T > > ,
1423- b : Peekable < & ' a T , SetItems < ' a , T > > ,
1424- }
1425-
14261341/// A lazy iterator producing elements in the set symmetric difference (in-order).
1427- #[ cfg( not( stage0) ) ]
14281342pub struct SymDifferenceItems < ' a , T : ' a > {
14291343 a : Peekable < & ' a T , SetItems < ' a , T > > ,
14301344 b : Peekable < & ' a T , SetItems < ' a , T > > ,
14311345}
14321346
1433- /// Note: stage0-specific version that lacks bound on A.
1434- #[ cfg( stage0) ]
1435- pub struct IntersectionItems < ' a , T > {
1436- a : Peekable < & ' a T , SetItems < ' a , T > > ,
1437- b : Peekable < & ' a T , SetItems < ' a , T > > ,
1438- }
1439-
14401347/// A lazy iterator producing elements in the set intersection (in-order).
1441- #[ cfg( not( stage0) ) ]
14421348pub struct IntersectionItems < ' a , T : ' a > {
14431349 a : Peekable < & ' a T , SetItems < ' a , T > > ,
14441350 b : Peekable < & ' a T , SetItems < ' a , T > > ,
14451351}
14461352
1447- /// Note: stage0-specific version that lacks bound on A.
1448- #[ cfg( stage0) ]
1449- pub struct UnionItems < ' a , T > {
1450- a : Peekable < & ' a T , SetItems < ' a , T > > ,
1451- b : Peekable < & ' a T , SetItems < ' a , T > > ,
1452- }
1453-
14541353/// A lazy iterator producing elements in the set union (in-order).
1455- #[ cfg( not( stage0) ) ]
14561354pub struct UnionItems < ' a , T : ' a > {
14571355 a : Peekable < & ' a T , SetItems < ' a , T > > ,
14581356 b : Peekable < & ' a T , SetItems < ' a , T > > ,
0 commit comments