2013-11-21 23:30:34 -06:00
|
|
|
use std::cell::RefCell;
|
2013-11-16 16:35:35 -06:00
|
|
|
|
2018-05-25 05:36:58 -05:00
|
|
|
fn main() {
|
2015-01-31 10:23:42 -06:00
|
|
|
let m = RefCell::new(0);
|
2013-11-16 16:35:35 -06:00
|
|
|
let p;
|
|
|
|
{
|
|
|
|
let b = m.borrow();
|
2017-11-20 06:13:27 -06:00
|
|
|
p = &*b;
|
2017-12-13 19:27:23 -06:00
|
|
|
}
|
|
|
|
//~^^ ERROR `b` does not live long enough
|
2018-05-25 05:36:58 -05:00
|
|
|
p.use_ref();
|
2013-11-16 16:35:35 -06: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 { }
|