forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
That issue was a dupe of 99852, but it's always better to have multiple regression tests rather than one.
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// compile-flags: -Zvalidate-mir -C opt-level=3 | ||
// build-pass | ||
#![feature(let_chains)] | ||
struct TupleIter<T, I: Iterator<Item = T>> { | ||
inner: I, | ||
} | ||
|
||
impl<T, I: Iterator<Item = T>> Iterator for TupleIter<T, I> { | ||
type Item = (T, T, T); | ||
|
||
fn next(&mut self) -> Option<Self::Item> { | ||
let inner = &mut self.inner; | ||
|
||
if let Some(first) = inner.next() | ||
&& let Some(second) = inner.next() | ||
&& let Some(third) = inner.next() | ||
{ | ||
Some((first, second, third)) | ||
} else { | ||
None | ||
} | ||
} | ||
} | ||
|
||
fn main() { | ||
let vec: Vec<u8> = Vec::new(); | ||
let mut tup_iter = TupleIter { | ||
inner: vec.into_iter(), | ||
}; | ||
tup_iter.next(); | ||
} |