about summary refs log tree commit diff
diff options
context:
space:
mode:
authorest31 <MTest31@outlook.com>2024-11-16 05:21:09 +0100
committerest31 <MTest31@outlook.com>2024-11-16 05:21:09 +0100
commitf502dcea3839ff48a9960e07130f203bfd4a07b2 (patch)
tree2d16895715e0a000799bcac227c00b47b5e408d3
parent427d9152d2f5899f0a338ac96b3e7b33d10e6f97 (diff)
downloadrust-f502dcea3839ff48a9960e07130f203bfd4a07b2.tar.gz
rust-f502dcea3839ff48a9960e07130f203bfd4a07b2.zip
Add regression test for issue #103476, fixed in edition 2024
-rw-r--r--tests/ui/rfcs/rfc-2497-if-let-chains/temporary-early-drop.rs25
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-2497-if-let-chains/temporary-early-drop.rs b/tests/ui/rfcs/rfc-2497-if-let-chains/temporary-early-drop.rs
new file mode 100644
index 00000000000..389c76337f0
--- /dev/null
+++ b/tests/ui/rfcs/rfc-2497-if-let-chains/temporary-early-drop.rs
@@ -0,0 +1,25 @@
+// issue-103476
+//@ compile-flags: -Zlint-mir -Zunstable-options
+//@ edition: 2024
+//@ check-pass
+
+#![feature(let_chains)]
+#![allow(irrefutable_let_patterns)]
+
+struct Pd;
+
+impl Pd {
+    fn it(&self) -> It {
+        todo!()
+    }
+}
+
+pub struct It<'a>(Box<dyn Tr<'a>>);
+
+trait Tr<'a> {}
+
+fn f(m: Option<Pd>) {
+    if let Some(n) = m && let it = n.it() {};
+}
+
+fn main() {}