rust/src/test/ui/borrowck/borrowck-drop-from-guard.rs
2018-12-25 21:08:33 -07:00

14 lines
255 B
Rust

//compile-flags: -Z borrowck=mir
fn foo(_:String) {}
fn main()
{
let my_str = "hello".to_owned();
match Some(42) {
Some(_) if { drop(my_str); false } => {}
Some(_) => {}
None => { foo(my_str); } //~ ERROR [E0382]
}
}