Skip to content

Commit 385af48

Browse files
committed
---
yaml --- r: 11380 b: refs/heads/master c: 86e1d4e h: refs/heads/master v: v3
1 parent f43ebdf commit 385af48

File tree

4 files changed

+52
-33
lines changed

4 files changed

+52
-33
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 57be673025556516747f50117672cb293864a5a5
2+
refs/heads/master: 86e1d4ecbd7564ad2e2c95c260a92b2ce3f7860f
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustdoc/astsrv.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ fn should_ignore_external_import_paths_that_dont_exist() {
232232
mk_srv_from_str(source);
233233
}
234234

235-
fn exec<T>(
235+
fn exec<T:send>(
236236
srv: srv,
237237
f: fn~(ctxt: ctxt) -> T
238238
) -> T {

trunk/src/rustdoc/attr_pass.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ fn fold_item(
8686
}
8787
}
8888

89-
fn parse_item_attrs<T>(
89+
fn parse_item_attrs<T:send>(
9090
srv: astsrv::srv,
9191
id: doc::ast_id,
9292
parse_attrs: fn~([ast::attribute]) -> T) -> T {

trunk/src/rustdoc/reexport_pass.rs

Lines changed: 49 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,57 @@ fn run(srv: astsrv::srv, doc: doc::cratedoc) -> doc::cratedoc {
3131
merge_reexports(doc, path_map)
3232
}
3333

34+
// Hash maps are not sendable so converting them back and forth
35+
// to association lists. Yuck.
36+
fn to_assoc_list<K:copy, V:copy>(
37+
map: map::hashmap<K, V>
38+
) -> [(K, V)] {
39+
40+
let vec = [];
41+
map.items {|k, v|
42+
vec += [(k, v)];
43+
}
44+
ret vec;
45+
}
46+
47+
fn from_assoc_list<K:copy, V:copy>(
48+
list: [(K, V)],
49+
new_hash: fn() -> map::hashmap<K, V>
50+
) -> map::hashmap<K, V> {
51+
52+
let map = new_hash();
53+
vec::iter(list) {|elt|
54+
let (k, v) = elt;
55+
map.insert(k, v);
56+
}
57+
ret map;
58+
}
59+
60+
fn from_def_assoc_list<V:copy>(
61+
list: [(ast::def_id, V)]
62+
) -> map::hashmap<ast::def_id, V> {
63+
from_assoc_list(list, bind common::new_def_hash())
64+
}
65+
66+
fn from_str_assoc_list<V:copy>(
67+
list: [(str, V)]
68+
) -> map::hashmap<str, V> {
69+
from_assoc_list(list, bind map::new_str_hash())
70+
}
71+
3472
fn build_reexport_def_set(srv: astsrv::srv) -> def_set {
35-
astsrv::exec(srv) {|ctxt|
73+
let assoc_list = astsrv::exec(srv) {|ctxt|
3674
let def_set = common::new_def_hash();
3775
ctxt.exp_map.items {|_path, defs|
3876
for def in *defs {
3977
let def_id = ast_util::def_id_of_def(def);
4078
def_set.insert(def_id, ());
4179
}
4280
}
43-
def_set
44-
}
81+
to_assoc_list(def_set)
82+
};
83+
84+
from_def_assoc_list(assoc_list)
4585
}
4686

4787
fn build_reexport_def_map(
@@ -85,38 +125,15 @@ fn build_reexport_def_map(
85125
}
86126
}
87127

88-
fn to_assoc_list<V:copy>(
89-
map: map::hashmap<ast::def_id, V>
90-
) -> [(ast::def_id, V)] {
91-
92-
let vec = [];
93-
map.items {|k, v|
94-
vec += [(k, v)];
95-
}
96-
ret vec;
97-
}
98-
99-
fn from_assoc_list<V:copy>(
100-
list: [(ast::def_id, V)]
101-
) -> map::hashmap<ast::def_id, V> {
102-
103-
let map = common::new_def_hash();
104-
vec::iter(list) {|elt|
105-
let (k, v) = elt;
106-
map.insert(k, v);
107-
}
108-
ret map;
109-
}
110-
111128
fn build_reexport_path_map(srv: astsrv::srv, -def_map: def_map) -> path_map {
112129

113130
// This is real unfortunate. Lots of copying going on here
114131
let def_assoc_list = to_assoc_list(def_map);
115132
#debug("def_map: %?", def_assoc_list);
116133

117-
astsrv::exec(srv) {|ctxt|
134+
let assoc_list = astsrv::exec(srv) {|ctxt|
118135

119-
let def_map = from_assoc_list(def_assoc_list);
136+
let def_map = from_def_assoc_list(def_assoc_list);
120137
let path_map = map::new_str_hash();
121138

122139
ctxt.exp_map.items {|path, defs|
@@ -149,8 +166,10 @@ fn build_reexport_path_map(srv: astsrv::srv, -def_map: def_map) -> path_map {
149166
}
150167
}
151168

152-
path_map
153-
}
169+
to_assoc_list(path_map)
170+
};
171+
172+
from_str_assoc_list(assoc_list)
154173
}
155174

156175
fn merge_reexports(

0 commit comments

Comments
 (0)