Skip to content

Commit 77b2da3

Browse files
committed
---
yaml --- r: 11490 b: refs/heads/master c: 59d6ec8 h: refs/heads/master v: v3
1 parent 746b488 commit 77b2da3

File tree

3 files changed

+44
-19
lines changed

3 files changed

+44
-19
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: 4675f860849c5d064d1279b2eff324a271024254
2+
refs/heads/master: 59d6ec8bd95091658a47eda23a6d7878777a6bb6
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 4a81779abd786ff22d71434c6d9a5917ea4cdfff
55
refs/heads/try: 2898dcc5d97da9427ac367542382b6239d9c0bbf

trunk/src/rustdoc/fold.rs

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,23 @@ fn mk_fold<T:copy>(
7979
})
8080
}
8181

82+
fn default_any_fold<T:send>(ctxt: T) -> fold<T> {
83+
mk_fold(
84+
ctxt,
85+
{|f, d| default_seq_fold_crate(f, d)},
86+
{|f, d| default_seq_fold_item(f, d)},
87+
{|f, d| default_any_fold_mod(f, d)},
88+
{|f, d| default_seq_fold_nmod(f, d)},
89+
{|f, d| default_seq_fold_fn(f, d)},
90+
{|f, d| default_seq_fold_const(f, d)},
91+
{|f, d| default_seq_fold_enum(f, d)},
92+
{|f, d| default_seq_fold_res(f, d)},
93+
{|f, d| default_seq_fold_iface(f, d)},
94+
{|f, d| default_seq_fold_impl(f, d)},
95+
{|f, d| default_seq_fold_type(f, d)}
96+
)
97+
}
98+
8299
fn default_seq_fold<T:copy>(ctxt: T) -> fold<T> {
83100
mk_fold(
84101
ctxt,
@@ -113,12 +130,6 @@ fn default_par_fold<T:send>(ctxt: T) -> fold<T> {
113130
)
114131
}
115132

116-
// Just a convenient wrapper to convert back and forth between
117-
// parallel and sequential folds for perf testing
118-
fn default_any_fold<T:send>(ctxt: T) -> fold<T> {
119-
default_seq_fold(ctxt)
120-
}
121-
122133
fn default_seq_fold_crate<T>(
123134
fold: fold<T>,
124135
doc: doc::cratedoc
@@ -135,27 +146,27 @@ fn default_seq_fold_item<T>(
135146
doc
136147
}
137148

138-
fn default_seq_fold_mod<T>(
149+
fn default_any_fold_mod<T:send>(
139150
fold: fold<T>,
140151
doc: doc::moddoc
141152
) -> doc::moddoc {
142153
{
143154
item: fold.fold_item(fold, doc.item),
144-
items: vec::map(doc.items) {|itemtag|
155+
items: util::anymap(doc.items) {|itemtag|
145156
fold_itemtag(fold, itemtag)
146157
}
147158
with doc
148159
}
149160
}
150161

151-
fn default_seq_fold_nmod<T>(
162+
fn default_seq_fold_mod<T>(
152163
fold: fold<T>,
153-
doc: doc::nmoddoc
154-
) -> doc::nmoddoc {
164+
doc: doc::moddoc
165+
) -> doc::moddoc {
155166
{
156167
item: fold.fold_item(fold, doc.item),
157-
fns: vec::map(doc.fns) {|fndoc|
158-
fold.fold_fn(fold, fndoc)
168+
items: util::seqmap(doc.items) {|itemtag|
169+
fold_itemtag(fold, itemtag)
159170
}
160171
with doc
161172
}
@@ -174,11 +185,17 @@ fn default_par_fold_mod<T:send>(
174185
}
175186
}
176187

177-
fn default_any_fold_mod<T:send>(
188+
fn default_seq_fold_nmod<T>(
178189
fold: fold<T>,
179-
doc: doc::moddoc
180-
) -> doc::moddoc {
181-
default_seq_fold_mod(fold, doc)
190+
doc: doc::nmoddoc
191+
) -> doc::nmoddoc {
192+
{
193+
item: fold.fold_item(fold, doc.item),
194+
fns: vec::map(doc.fns) {|fndoc|
195+
fold.fold_fn(fold, fndoc)
196+
}
197+
with doc
198+
}
182199
}
183200

184201
fn fold_itemtag<T>(fold: fold<T>, doc: doc::itemtag) -> doc::itemtag {

trunk/src/rustdoc/util.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
1-
export parmap;
1+
export anymap, seqmap, parmap;
2+
3+
fn anymap<T:send, U:send>(v: [T], f: fn(T) -> U) -> [U] {
4+
seqmap(v, f)
5+
}
6+
7+
fn seqmap<T, U>(v: [T], f: fn(T) -> U) -> [U] {
8+
vec::map(v, f)
9+
}
210

311
fn parmap<T:send, U:send>(v: [T], f: fn~(T) -> U) -> [U] unsafe {
412
let futures = vec::map(v) {|elt|

0 commit comments

Comments
 (0)