summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/user-annotations/pattern_substs_on_brace_struct.rs
blob: 1586c4ea30c62b2a56c78b92de4302058c2260b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
struct Foo<'a> { field: &'a u32 }

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

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

fn main() { }