diff options
Diffstat (limited to 'src/test/ui/issues/issue-13058.rs')
-rw-r--r-- | src/test/ui/issues/issue-13058.rs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/test/ui/issues/issue-13058.rs b/src/test/ui/issues/issue-13058.rs new file mode 100644 index 000000000..a5806feb7 --- /dev/null +++ b/src/test/ui/issues/issue-13058.rs @@ -0,0 +1,27 @@ +use std::ops::Range; + +trait Itble<'r, T, I: Iterator<Item=T>> { fn iter(&'r self) -> I; } + +impl<'r> Itble<'r, usize, Range<usize>> for (usize, usize) { + fn iter(&'r self) -> Range<usize> { + let &(min, max) = self; + min..max + } +} + +fn check<'r, I: Iterator<Item=usize>, T: Itble<'r, usize, I>>(cont: &T) -> bool +{ + let cont_iter = cont.iter(); +//~^ ERROR explicit lifetime required in the type of `cont` [E0621] + let result = cont_iter.fold(Some(0), |state, val| { + state.map_or(None, |mask| { + let bit = 1 << val; + if mask & bit == 0 {Some(mask|bit)} else {None} + }) + }); + result.is_some() +} + +fn main() { + check(&(3, 5)); +} |