Skip to content

Commit b7ffa06

Browse files
committed
This produces an error
1 parent 81622c6 commit b7ffa06

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

src/libcore/iter/mod.rs

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ impl<I: Iterator, P> Iterator for Filter<I, P> where P: FnMut(&I::Item) -> bool
13681368
}
13691369

13701370
#[inline]
1371-
fn size_hint(&self) -> (usize, Option<usize>) {
1371+
default fn size_hint(&self) -> (usize, Option<usize>) {
13721372
let (_, upper) = self.iter.size_hint();
13731373
(0, upper) // can't know a lower bound, due to the predicate
13741374
}
@@ -1418,6 +1418,26 @@ impl<I: Iterator, P> Iterator for Filter<I, P> where P: FnMut(&I::Item) -> bool
14181418
}
14191419
}
14201420

1421+
use ops::RangeFrom;
1422+
///
1423+
#[unstable(feature="test", issue="0")]
1424+
pub trait FancyIter: Iterator {}
1425+
#[unstable(feature="test", issue="0")]
1426+
impl<T: Step> FancyIter for RangeFrom<T> {}
1427+
1428+
#[unstable(feature="test", issue="0")]
1429+
impl<I: FancyIter, P: FnMut(&I::Item) -> bool> Iterator for Filter<I, P> {
1430+
fn size_hint(&self) -> (usize, Option<usize>) {
1431+
(0, None)
1432+
}
1433+
}
1434+
1435+
#[allow(warnings)]
1436+
fn foo() {
1437+
let foo: isize = (0..).filter(|i| *i < 5).next().unwrap();
1438+
}
1439+
1440+
14211441
#[stable(feature = "rust1", since = "1.0.0")]
14221442
impl<I: DoubleEndedIterator, P> DoubleEndedIterator for Filter<I, P>
14231443
where P: FnMut(&I::Item) -> bool,

0 commit comments

Comments
 (0)