diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs index 886f2d1c0831..b98c79f8d0e7 100644 --- a/src/libcore/gc.rs +++ b/src/libcore/gc.rs @@ -44,7 +44,7 @@ use io; use libc::{size_t, uintptr_t}; use option::{None, Option, Some}; use ptr; -use send_map::linear::LinearMap; +use send_map::linear::LinearSet; use stackwalk; use sys; @@ -294,12 +294,6 @@ pub fn gc() { } } -type RootSet = LinearMap<*Word,()>; - -fn RootSet() -> RootSet { - LinearMap() -} - #[cfg(gc)] fn expect_sentinel() -> bool { true } @@ -337,13 +331,13 @@ pub fn cleanup_stack_for_failure() { ptr::null() }; - let mut roots = ~RootSet(); + let mut roots = LinearSet::new(); for walk_gc_roots(need_cleanup, sentinel) |root, tydesc| { // Track roots to avoid double frees. - if roots.find(&*root).is_some() { + if roots.contains(&*root) { loop; } - roots.insert(*root, ()); + roots.insert(*root); if ptr::is_null(tydesc) { // FIXME #4420: Destroy this box diff --git a/src/libcore/send_map.rs b/src/libcore/send_map.rs index dc4e24c4f8a3..788c4fdbd5e4 100644 --- a/src/libcore/send_map.rs +++ b/src/libcore/send_map.rs @@ -485,7 +485,7 @@ pub mod linear { fn remove(&mut self, value: &T) -> bool { self.map.remove(value) } } - impl LinearSet { + pub impl LinearSet { /// Create an empty LinearSet static fn new() -> LinearSet { LinearSet{map: LinearMap()} } }