rust/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency.rs
2024-02-16 20:02:50 +00:00

25 lines
439 B
Rust

// Check that temporaries in if-let guards are correctly scoped.
//@ build-pass
// -Zvalidate-mir
#![feature(if_let_guard)]
fn fun() {
match 0 {
_ => (),
_ if let Some(s) = std::convert::identity(&Some(String::new())) => {}
_ => (),
}
}
fn funner() {
match 0 {
_ => (),
_ | _ if let Some(s) = std::convert::identity(&Some(String::new())) => {}
_ => (),
}
}
fn main() {}