Skip to content

Commit ca7f7cf

Browse files
committed
rollup merge of #23637: apasel422/iter
2 parents c7509bb + 88edf97 commit ca7f7cf

File tree

4 files changed

+33
-1
lines changed

4 files changed

+33
-1
lines changed

src/libcollections/bit.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,12 +1804,16 @@ struct TwoBitPositions<'a> {
18041804
next_idx: usize
18051805
}
18061806

1807+
#[derive(Clone)]
18071808
#[stable(feature = "rust1", since = "1.0.0")]
18081809
pub struct Union<'a>(TwoBitPositions<'a>);
1810+
#[derive(Clone)]
18091811
#[stable(feature = "rust1", since = "1.0.0")]
18101812
pub struct Intersection<'a>(Take<TwoBitPositions<'a>>);
1813+
#[derive(Clone)]
18111814
#[stable(feature = "rust1", since = "1.0.0")]
18121815
pub struct Difference<'a>(TwoBitPositions<'a>);
1816+
#[derive(Clone)]
18131817
#[stable(feature = "rust1", since = "1.0.0")]
18141818
pub struct SymmetricDifference<'a>(TwoBitPositions<'a>);
18151819

src/libcollections/linked_list.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,8 @@ impl<A> DoubleEndedIterator for IntoIter<A> {
832832
fn next_back(&mut self) -> Option<A> { self.list.pop_back() }
833833
}
834834

835+
impl<A> ExactSizeIterator for IntoIter<A> {}
836+
835837
#[stable(feature = "rust1", since = "1.0.0")]
836838
impl<A> FromIterator<A> for LinkedList<A> {
837839
fn from_iter<T: IntoIterator<Item=A>>(iter: T) -> LinkedList<A> {

src/libcollections/vec_deque.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,7 @@ impl<T> VecDeque<T> {
556556
}
557557
}
558558

559-
/// Consumes the list into an iterator yielding elements by value.
559+
/// Consumes the list into a front-to-back iterator yielding elements by value.
560560
#[stable(feature = "rust1", since = "1.0.0")]
561561
pub fn into_iter(self) -> IntoIter<T> {
562562
IntoIter {
@@ -1573,6 +1573,7 @@ impl<'a, T> DoubleEndedIterator for IterMut<'a, T> {
15731573
impl<'a, T> ExactSizeIterator for IterMut<'a, T> {}
15741574

15751575
/// A by-value VecDeque iterator
1576+
#[derive(Clone)]
15761577
#[stable(feature = "rust1", since = "1.0.0")]
15771578
pub struct IntoIter<T> {
15781579
inner: VecDeque<T>,

src/libstd/collections/hash/set.rs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,9 @@ impl<T, S> IntoIterator for HashSet<T, S>
853853
}
854854
}
855855

856+
impl<'a, K> Clone for Iter<'a, K> {
857+
fn clone(&self) -> Iter<'a, K> { Iter { iter: self.iter.clone() } }
858+
}
856859
#[stable(feature = "rust1", since = "1.0.0")]
857860
impl<'a, K> Iterator for Iter<'a, K> {
858861
type Item = &'a K;
@@ -889,6 +892,12 @@ impl<'a, K> ExactSizeIterator for Drain<'a, K> {
889892
fn len(&self) -> usize { self.iter.len() }
890893
}
891894

895+
impl<'a, T, S> Clone for Intersection<'a, T, S> {
896+
fn clone(&self) -> Intersection<'a, T, S> {
897+
Intersection { iter: self.iter.clone(), ..*self }
898+
}
899+
}
900+
892901
#[stable(feature = "rust1", since = "1.0.0")]
893902
impl<'a, T, S> Iterator for Intersection<'a, T, S>
894903
where T: Eq + Hash, S: HashState
@@ -912,6 +921,12 @@ impl<'a, T, S> Iterator for Intersection<'a, T, S>
912921
}
913922
}
914923

924+
impl<'a, T, S> Clone for Difference<'a, T, S> {
925+
fn clone(&self) -> Difference<'a, T, S> {
926+
Difference { iter: self.iter.clone(), ..*self }
927+
}
928+
}
929+
915930
#[stable(feature = "rust1", since = "1.0.0")]
916931
impl<'a, T, S> Iterator for Difference<'a, T, S>
917932
where T: Eq + Hash, S: HashState
@@ -935,6 +950,12 @@ impl<'a, T, S> Iterator for Difference<'a, T, S>
935950
}
936951
}
937952

953+
impl<'a, T, S> Clone for SymmetricDifference<'a, T, S> {
954+
fn clone(&self) -> SymmetricDifference<'a, T, S> {
955+
SymmetricDifference { iter: self.iter.clone() }
956+
}
957+
}
958+
938959
#[stable(feature = "rust1", since = "1.0.0")]
939960
impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S>
940961
where T: Eq + Hash, S: HashState
@@ -945,6 +966,10 @@ impl<'a, T, S> Iterator for SymmetricDifference<'a, T, S>
945966
fn size_hint(&self) -> (usize, Option<usize>) { self.iter.size_hint() }
946967
}
947968

969+
impl<'a, T, S> Clone for Union<'a, T, S> {
970+
fn clone(&self) -> Union<'a, T, S> { Union { iter: self.iter.clone() } }
971+
}
972+
948973
#[stable(feature = "rust1", since = "1.0.0")]
949974
impl<'a, T, S> Iterator for Union<'a, T, S>
950975
where T: Eq + Hash, S: HashState

0 commit comments

Comments
 (0)