diff options
| author | est31 <MTest31@outlook.com> | 2025-05-14 00:45:28 +0200 |
|---|---|---|
| committer | est31 <MTest31@outlook.com> | 2025-05-14 00:45:28 +0200 |
| commit | 7b45c59d40bf9136916eb487183999bfda18c99c (patch) | |
| tree | cf17cf57082c00256055cd28c0a89d70372f9dc1 /tests/ui/rfcs | |
| parent | 5c2677d01761b159df99e2e381761ae770411746 (diff) | |
| download | rust-7b45c59d40bf9136916eb487183999bfda18c99c.tar.gz rust-7b45c59d40bf9136916eb487183999bfda18c99c.zip | |
Add match guard chains test for absence of compilation error
based on tests/ui/rfcs/rfc-2497-if-let-chains/temporary-early-drop.rs
Diffstat (limited to 'tests/ui/rfcs')
| -rw-r--r-- | tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs b/tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs new file mode 100644 index 00000000000..9edbc3243c7 --- /dev/null +++ b/tests/ui/rfcs/rfc-2294-if-let-guard/temporary-early-drop.rs @@ -0,0 +1,29 @@ +// issue-103476 +//@ revisions: edition2021 edition2024 +//@ [edition2021] edition: 2021 +//@ [edition2024] edition: 2024 +//@ check-pass + +#![feature(if_let_guard)] +#![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>) { + match () { + () if let Some(n) = m && let it = n.it() => {} + _ => {} + } +} + +fn main() {} |
