1
Fork 0

Enable an old test that works now!

This commit is contained in:
Scott Olson 2016-12-17 01:58:03 -08:00
parent 0cc4535a58
commit 9e244251a0

View file

@ -1,4 +1,4 @@
use std::cell::Cell;
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use std::sync::Arc;
@ -9,14 +9,12 @@ fn rc_cell() -> Rc<Cell<i32>> {
r
}
// TODO(solson): also requires destructors to run for the second borrow to work
// TODO(solson): needs StructWrappedNullablePointer support
// fn rc_refcell() -> i32 {
// let r = Rc::new(RefCell::new(42));
// *r.borrow_mut() += 10;
// let x = *r.borrow();
// x
// }
fn rc_refcell() -> i32 {
let r = Rc::new(RefCell::new(42));
*r.borrow_mut() += 10;
let x = *r.borrow();
x
}
fn arc() -> Arc<i32> {
let a = Arc::new(42);
@ -30,5 +28,6 @@ fn true_assert() {
fn main() {
assert_eq!(*arc(), 42);
assert_eq!(rc_cell().get(), 84);
assert_eq!(rc_refcell(), 52);
true_assert();
}