Skip to content

Commit

Permalink
Add regression test for issue 99938
Browse files Browse the repository at this point in the history
That issue was a dupe of 99852, but it's always better to
have multiple regression tests rather than one.
  • Loading branch information
est31 committed Nov 23, 2022
1 parent 3f2b2ee commit 9abd785
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/test/ui/rfc-2497-if-let-chains/issue-99938.rs
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();
}

0 comments on commit 9abd785

Please sign in to comment.