]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/user-annotations/pattern_substs_on_brace_enum_variant.rs
Rollup merge of #106144 - tgross35:patch-1, r=Mark-Simulacrum
[rust.git] / tests / ui / nll / user-annotations / pattern_substs_on_brace_enum_variant.rs
1 enum Foo<'a> {
2     Bar { field: &'a u32 }
3 }
4
5 fn in_let() {
6     let y = 22;
7     let foo = Foo::Bar { field: &y };
8     //~^ ERROR `y` does not live long enough
9     let Foo::Bar::<'static> { field: _z } = foo;
10 }
11
12 fn in_match() {
13     let y = 22;
14     let foo = Foo::Bar { field: &y };
15     //~^ ERROR `y` does not live long enough
16     match foo {
17         Foo::Bar::<'static> { field: _z } => {
18         }
19     }
20 }
21
22 fn main() { }