libstd: De-@mut
the heap_cycles
test
This commit is contained in:
parent
aa93e6e664
commit
e095889e4e
1 changed files with 8 additions and 4 deletions
|
@ -444,16 +444,20 @@ mod test {
|
|||
|
||||
#[test]
|
||||
fn heap_cycles() {
|
||||
use cell::RefCell;
|
||||
use option::{Option, Some, None};
|
||||
|
||||
struct List {
|
||||
next: Option<@mut List>,
|
||||
next: Option<@RefCell<List>>,
|
||||
}
|
||||
|
||||
let a = @mut List { next: None };
|
||||
let b = @mut List { next: Some(a) };
|
||||
let a = @RefCell::new(List { next: None });
|
||||
let b = @RefCell::new(List { next: Some(a) });
|
||||
|
||||
a.next = Some(b);
|
||||
{
|
||||
let mut a = a.borrow_mut();
|
||||
a.get().next = Some(b);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Reference in a new issue