@@ -668,20 +668,7 @@ impl<K: Ord, V> TreeMap<K, V> {
668
668
}
669
669
}
670
670
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
-
683
671
/// Lazy forward iterator over a map
684
- #[ cfg( not( stage0) ) ]
685
672
pub struct Entries < ' a , K : ' a , V : ' a > {
686
673
stack : Vec < & ' a TreeNode < K , V > > ,
687
674
// See the comment on MutEntries; this is just to allow
@@ -692,49 +679,13 @@ pub struct Entries<'a, K:'a, V:'a> {
692
679
remaining_max : uint
693
680
}
694
681
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
-
701
682
/// Lazy backward iterator over a map
702
- #[ cfg( not( stage0) ) ]
703
683
pub struct RevEntries < ' a , K : ' a , V : ' a > {
704
684
iter : Entries < ' a , K , V > ,
705
685
}
706
686
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
-
735
687
/// Lazy forward iterator over a map that allows for the mutation of
736
688
/// the values.
737
- #[ cfg( not( stage0) ) ]
738
689
pub struct MutEntries < ' a , K : ' a , V : ' a > {
739
690
stack : Vec < & ' a mut TreeNode < K , V > > ,
740
691
// Unfortunately, we require some unsafe-ness to get around the
@@ -761,14 +712,7 @@ pub struct MutEntries<'a, K:'a, V:'a> {
761
712
remaining_max : uint
762
713
}
763
714
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
-
770
715
/// Lazy backward iterator over a map
771
- #[ cfg( not( stage0) ) ]
772
716
pub struct RevMutEntries < ' a , K : ' a , V : ' a > {
773
717
iter : MutEntries < ' a , K , V > ,
774
718
}
@@ -1375,84 +1319,38 @@ impl<T: Ord> TreeSet<T> {
1375
1319
}
1376
1320
}
1377
1321
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
-
1384
1322
/// A lazy forward iterator over a set.
1385
- #[ cfg( not( stage0) ) ]
1386
1323
pub struct SetItems < ' a , T : ' a > {
1387
1324
iter : Entries < ' a , T , ( ) >
1388
1325
}
1389
1326
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
-
1396
1327
/// A lazy backward iterator over a set.
1397
- #[ cfg( not( stage0) ) ]
1398
1328
pub struct RevSetItems < ' a , T : ' a > {
1399
1329
iter : RevEntries < ' a , T , ( ) >
1400
1330
}
1401
1331
1402
1332
/// A lazy forward iterator over a set that consumes the set while iterating.
1403
1333
pub type MoveSetItems < T > = iter:: Map < ' static , ( T , ( ) ) , T , MoveEntries < T , ( ) > > ;
1404
1334
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
-
1412
1335
/// A lazy iterator producing elements in the set difference (in-order).
1413
- #[ cfg( not( stage0) ) ]
1414
1336
pub struct DifferenceItems < ' a , T : ' a > {
1415
1337
a : Peekable < & ' a T , SetItems < ' a , T > > ,
1416
1338
b : Peekable < & ' a T , SetItems < ' a , T > > ,
1417
1339
}
1418
1340
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
-
1426
1341
/// A lazy iterator producing elements in the set symmetric difference (in-order).
1427
- #[ cfg( not( stage0) ) ]
1428
1342
pub struct SymDifferenceItems < ' a , T : ' a > {
1429
1343
a : Peekable < & ' a T , SetItems < ' a , T > > ,
1430
1344
b : Peekable < & ' a T , SetItems < ' a , T > > ,
1431
1345
}
1432
1346
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
-
1440
1347
/// A lazy iterator producing elements in the set intersection (in-order).
1441
- #[ cfg( not( stage0) ) ]
1442
1348
pub struct IntersectionItems < ' a , T : ' a > {
1443
1349
a : Peekable < & ' a T , SetItems < ' a , T > > ,
1444
1350
b : Peekable < & ' a T , SetItems < ' a , T > > ,
1445
1351
}
1446
1352
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
-
1454
1353
/// A lazy iterator producing elements in the set union (in-order).
1455
- #[ cfg( not( stage0) ) ]
1456
1354
pub struct UnionItems < ' a , T : ' a > {
1457
1355
a : Peekable < & ' a T , SetItems < ' a , T > > ,
1458
1356
b : Peekable < & ' a T , SetItems < ' a , T > > ,
0 commit comments