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