From f502dcea3839ff48a9960e07130f203bfd4a07b2 Mon Sep 17 00:00:00 2001 From: est31 Date: Sat, 16 Nov 2024 05:21:09 +0100 Subject: [PATCH] Add regression test for issue #103476, fixed in edition 2024 --- .../temporary-early-drop.rs | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tests/ui/rfcs/rfc-2497-if-let-chains/temporary-early-drop.rs 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 0000000000000..389c76337f097 --- /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>); + +trait Tr<'a> {} + +fn f(m: Option) { + if let Some(n) = m && let it = n.it() {}; +} + +fn main() {}