]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-29723.rs
Rollup merge of #106752 - sulami:master, r=estebank
[rust.git] / tests / ui / issues / issue-29723.rs
1 // test for https://github.com/rust-lang/rust/issues/29723
2
3 #![feature(if_let_guard)]
4
5 fn main() {
6     let s = String::new();
7     let _s = match 0 {
8         0 if { drop(s); false } => String::from("oops"),
9         _ => {
10             // This should trigger an error,
11             // s could have been moved from.
12             s
13             //~^ ERROR use of moved value: `s`
14         }
15     };
16
17     let s = String::new();
18     let _s = match 0 {
19         0 if let Some(()) = { drop(s); None } => String::from("oops"),
20         _ => s //~ ERROR use of moved value: `s`
21     };
22 }