rust/tests/ui/nll/user-annotations/pattern_substs_on_brace_enu...

23 lines
421 B
Rust

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() { }