summaryrefslogtreecommitdiffstats
path: root/tests/ui/rfc-2497-if-let-chains/issue-99938.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/rfc-2497-if-let-chains/issue-99938.rs')
-rw-r--r--tests/ui/rfc-2497-if-let-chains/issue-99938.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/ui/rfc-2497-if-let-chains/issue-99938.rs b/tests/ui/rfc-2497-if-let-chains/issue-99938.rs
new file mode 100644
index 000000000..bd81ce0b1
--- /dev/null
+++ b/tests/ui/rfc-2497-if-let-chains/issue-99938.rs
@@ -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();
+}