2018-05-25 05:36:58 -05:00
|
|
|
fn main() {
|
2016-10-14 10:55:45 -05:00
|
|
|
let p;
|
2018-05-25 05:36:58 -05:00
|
|
|
{
|
|
|
|
let a = 42;
|
|
|
|
p = &a;
|
|
|
|
//~^ ERROR `a` does not live long enough
|
|
|
|
|
|
|
|
}
|
|
|
|
p.use_ref();
|
|
|
|
|
2016-10-14 10:55:45 -05:00
|
|
|
}
|
2018-05-25 05:36:58 -05:00
|
|
|
|
|
|
|
trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
|
|
|
|
impl<T> Fake for T { }
|