rust/tests/ui/rfcs/rfc-2294-if-let-guard/scoping-consistency.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
439 B
Rust
Raw Normal View History

// 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() {}