Rollup merge of #104771 - est31:if_let_chain_broken_mir_test, r=davidtwco
Add regression test for issue #99938 That issue was a dupe of #99852, and it got fixed since, but it's always better to have multiple regression tests rather than one. closes #99938
This commit is contained in:
commit
84ff4ab5a2
31
src/test/ui/rfc-2497-if-let-chains/issue-99938.rs
Normal file
31
src/test/ui/rfc-2497-if-let-chains/issue-99938.rs
Normal file
@ -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();
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user