summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/borrowck-drop-from-guard.rs
blob: 0f320af2657603bf20d82a7ab4f7e300974633ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#![feature(if_let_guard)]

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]
    }

    let my_str = "hello".to_owned();
    match Some(42) {
        Some(_) if let Some(()) = { drop(my_str); None } => {}
        Some(_) => {}
        None => { foo(my_str); } //~ ERROR [E0382]
    }
}