rust/tests/ui/error-codes/E0597.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

13 lines
227 B
Rust
Raw Normal View History

2017-05-27 14:31:43 +00:00
struct Foo<'a> {
x: Option<&'a u32>,
}
fn main() {
2017-05-27 14:31:43 +00:00
let mut x = Foo { x: None };
let y = 0;
x.x = Some(&y);
//~^ `y` does not live long enough [E0597]
}
impl<'a> Drop for Foo<'a> { fn drop(&mut self) { } }