about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rustdoc/astsrv.rs2
-rw-r--r--src/rustdoc/attr_pass.rs2
-rw-r--r--src/rustdoc/reexport_pass.rs79
3 files changed, 51 insertions, 32 deletions
diff --git a/src/rustdoc/astsrv.rs b/src/rustdoc/astsrv.rs
index 750e3a2aeaf..3397691d5e3 100644
--- a/src/rustdoc/astsrv.rs
+++ b/src/rustdoc/astsrv.rs
@@ -232,7 +232,7 @@ fn should_ignore_external_import_paths_that_dont_exist() {
     mk_srv_from_str(source);
 }
 
-fn exec<T>(
+fn exec<T:send>(
     srv: srv,
     f: fn~(ctxt: ctxt) -> T
 ) -> T {
diff --git a/src/rustdoc/attr_pass.rs b/src/rustdoc/attr_pass.rs
index a0201cbcd04..2d0db9cf472 100644
--- a/src/rustdoc/attr_pass.rs
+++ b/src/rustdoc/attr_pass.rs
@@ -86,7 +86,7 @@ fn fold_item(
     }
 }
 
-fn parse_item_attrs<T>(
+fn parse_item_attrs<T:send>(
     srv: astsrv::srv,
     id: doc::ast_id,
     parse_attrs: fn~([ast::attribute]) -> T) -> T {
diff --git a/src/rustdoc/reexport_pass.rs b/src/rustdoc/reexport_pass.rs
index 21074cc46f8..6e199d88c4b 100644
--- a/src/rustdoc/reexport_pass.rs
+++ b/src/rustdoc/reexport_pass.rs
@@ -31,8 +31,46 @@ fn run(srv: astsrv::srv, doc: doc::cratedoc) -> doc::cratedoc {
     merge_reexports(doc, path_map)
 }
 
+// Hash maps are not sendable so converting them back and forth
+// to association lists. Yuck.
+fn to_assoc_list<K:copy, V:copy>(
+    map: map::hashmap<K, V>
+) -> [(K, V)] {
+
+    let vec = [];
+    map.items {|k, v|
+        vec += [(k, v)];
+    }
+    ret vec;
+}
+
+fn from_assoc_list<K:copy, V:copy>(
+    list: [(K, V)],
+    new_hash: fn() -> map::hashmap<K, V>
+) -> map::hashmap<K, V> {
+
+    let map = new_hash();
+    vec::iter(list) {|elt|
+        let (k, v) = elt;
+        map.insert(k, v);
+    }
+    ret map;
+}
+
+fn from_def_assoc_list<V:copy>(
+    list: [(ast::def_id, V)]
+) -> map::hashmap<ast::def_id, V> {
+    from_assoc_list(list, bind common::new_def_hash())
+}
+
+fn from_str_assoc_list<V:copy>(
+    list: [(str, V)]
+) -> map::hashmap<str, V> {
+    from_assoc_list(list, bind map::new_str_hash())
+}
+
 fn build_reexport_def_set(srv: astsrv::srv) -> def_set {
-    astsrv::exec(srv) {|ctxt|
+    let assoc_list = astsrv::exec(srv) {|ctxt|
         let def_set = common::new_def_hash();
         ctxt.exp_map.items {|_path, defs|
             for def in *defs {
@@ -40,8 +78,10 @@ fn build_reexport_def_set(srv: astsrv::srv) -> def_set {
                 def_set.insert(def_id, ());
             }
         }
-        def_set
-    }
+        to_assoc_list(def_set)
+    };
+
+    from_def_assoc_list(assoc_list)
 }
 
 fn build_reexport_def_map(
@@ -85,38 +125,15 @@ fn build_reexport_def_map(
     }
 }
 
-fn to_assoc_list<V:copy>(
-    map: map::hashmap<ast::def_id, V>
-) -> [(ast::def_id, V)] {
-
-    let vec = [];
-    map.items {|k, v|
-        vec += [(k, v)];
-    }
-    ret vec;
-}
-
-fn from_assoc_list<V:copy>(
-    list: [(ast::def_id, V)]
-) -> map::hashmap<ast::def_id, V> {
-
-    let map = common::new_def_hash();
-    vec::iter(list) {|elt|
-        let (k, v) = elt;
-        map.insert(k, v);
-    }
-    ret map;
-}
-
 fn build_reexport_path_map(srv: astsrv::srv, -def_map: def_map) -> path_map {
 
     // This is real unfortunate. Lots of copying going on here
     let def_assoc_list = to_assoc_list(def_map);
     #debug("def_map: %?", def_assoc_list);
 
-    astsrv::exec(srv) {|ctxt|
+    let assoc_list = astsrv::exec(srv) {|ctxt|
 
-        let def_map = from_assoc_list(def_assoc_list);
+        let def_map = from_def_assoc_list(def_assoc_list);
         let path_map = map::new_str_hash();
 
         ctxt.exp_map.items {|path, defs|
@@ -149,8 +166,10 @@ fn build_reexport_path_map(srv: astsrv::srv, -def_map: def_map) -> path_map {
             }
         }
 
-        path_map
-    }
+        to_assoc_list(path_map)
+    };
+
+    from_str_assoc_list(assoc_list)
 }
 
 fn merge_reexports(