2014-10-27 12:58:30 +01:00
|
|
|
// Tests the new destructor semantics.
|
|
|
|
|
|
|
|
|
|
use std::cell::RefCell;
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let b = {
|
2015-03-03 10:42:26 +02:00
|
|
|
let a = Box::new(RefCell::new(4));
|
2017-11-20 13:13:27 +01:00
|
|
|
*a.borrow() + 1
|
2017-12-13 17:27:23 -08:00
|
|
|
}; //~^ ERROR `*a` does not live long enough
|
2014-10-27 12:58:30 +01:00
|
|
|
println!("{}", b);
|
|
|
|
|
}
|