]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-drop-from-guard.rs
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-drop-from-guard.rs
1 #![feature(if_let_guard)]
2
3 fn foo(_:String) {}
4
5 fn main()
6 {
7     let my_str = "hello".to_owned();
8     match Some(42) {
9         Some(_) if { drop(my_str); false } => {}
10         Some(_) => {}
11         None => { foo(my_str); } //~ ERROR [E0382]
12     }
13
14     let my_str = "hello".to_owned();
15     match Some(42) {
16         Some(_) if let Some(()) = { drop(my_str); None } => {}
17         Some(_) => {}
18         None => { foo(my_str); } //~ ERROR [E0382]
19     }
20 }