summaryrefslogtreecommitdiffstats
path: root/src/test/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs
blob: 59cd69c0ca55d7c3d2e1280ed7d6a40f4d957403 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
enum Foo<'a> {
    Bar { field: &'a u32 }
}

fn in_let() {
    let y = 22;
    let foo = Foo::Bar { field: &y };
    //~^ ERROR `y` does not live long enough
    let Foo::Bar::<'static> { field: _z } = foo;
}

fn in_match() {
    let y = 22;
    let foo = Foo::Bar { field: &y };
    //~^ ERROR `y` does not live long enough
    match foo {
        Foo::Bar::<'static> { field: _z } => {
        }
    }
}

fn main() { }