Skip to content

Commit

Permalink
Auto merge of #34155 - ollie27:unzip, r=alexcrichton
Browse files Browse the repository at this point in the history
Remove unzip() SizeHint hack

This was using an invalid iterator so is likely to end with buggy
behaviour.

It also doesn't even benefit many type in std including Vec so removing it
shouldn't cause any problems.

Fixes: #33468
  • Loading branch information
bors authored Jun 21, 2016
2 parents 45cde97 + 02f9be8 commit fe96928
Showing 1 changed file with 0 additions and 15 deletions.
15 changes: 0 additions & 15 deletions src/libcore/iter/iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
use clone::Clone;
use cmp::{Ord, PartialOrd, PartialEq, Ordering};
use default::Default;
use marker;
use num::{Zero, One};
use ops::{Add, FnMut, Mul};
use option::Option::{self, Some, None};
Expand Down Expand Up @@ -1748,23 +1747,9 @@ pub trait Iterator {
FromB: Default + Extend<B>,
Self: Sized + Iterator<Item=(A, B)>,
{
struct SizeHint<A>(usize, Option<usize>, marker::PhantomData<A>);
impl<A> Iterator for SizeHint<A> {
type Item = A;

fn next(&mut self) -> Option<A> { None }
fn size_hint(&self) -> (usize, Option<usize>) {
(self.0, self.1)
}
}

let (lo, hi) = self.size_hint();
let mut ts: FromA = Default::default();
let mut us: FromB = Default::default();

ts.extend(SizeHint(lo, hi, marker::PhantomData));
us.extend(SizeHint(lo, hi, marker::PhantomData));

for (t, u) in self {
ts.extend(Some(t));
us.extend(Some(u));
Expand Down

0 comments on commit fe96928

Please sign in to comment.