about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-01-22 21:13:06 -0500
committerDaniel Micay <danielmicay@gmail.com>2013-01-22 21:28:28 -0500
commit7de5e6c487c2b3b803c619f8c19ffa8742535e49 (patch)
tree9e3276c395d5b3808a847f185ae47731d7f1722f /src/libcore
parent499f00de1d4139f07de96a864f2c0d3445946d94 (diff)
downloadrust-7de5e6c487c2b3b803c619f8c19ffa8742535e49.tar.gz
rust-7de5e6c487c2b3b803c619f8c19ffa8742535e49.zip
migrate gc.rs to LinearSet
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/gc.rs14
-rw-r--r--src/libcore/send_map.rs2
2 files changed, 5 insertions, 11 deletions
diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs
index 886f2d1c083..b98c79f8d0e 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 dc4e24c4f8a..788c4fdbd5e 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 <T: Hash IterBytes Eq> LinearSet<T> {
+    pub impl <T: Hash IterBytes Eq> LinearSet<T> {
         /// Create an empty LinearSet
         static fn new() -> LinearSet<T> { LinearSet{map: LinearMap()} }
     }