Skip to content

Commit b870ce7

Browse files
committed
auto merge of #11030 : cmr/rust/rustdoc_on_fire, r=metajack
By returning the items to process and storing them in a queue, we were losing the context that was setup for that item during the recursion. This is an easy fix, rather than hoisting out the state that it needs.
2 parents d5798b3 + 8b5a317 commit b870ce7

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/librustdoc/html/render.rs

+8-9
Original file line numberDiff line numberDiff line change
@@ -648,9 +648,13 @@ impl Context {
648648
self.root_path.push_str("../");
649649
self.current.push(s);
650650

651+
info!("Recursing into {}", self.dst.display());
652+
651653
mkdir(&self.dst);
652654
let ret = f(self);
653655

656+
info!("Recursed; leaving {}", self.dst.display());
657+
654658
// Go back to where we were at
655659
self.dst = prev;
656660
let len = self.root_path.len();
@@ -674,23 +678,18 @@ impl Context {
674678
// using a rwarc makes this parallelizable in the future
675679
local_data::set(cache_key, Arc::new(cache));
676680

677-
let mut work = ~[item];
678-
while work.len() > 0 {
679-
let item = work.pop();
680-
self.item(item, |_cx, item| {
681-
work.push(item);
682-
})
683-
}
681+
self.item(item);
684682
}
685683

686684
/// Non-parellelized version of rendering an item. This will take the input
687685
/// item, render its contents, and then invoke the specified closure with
688686
/// all sub-items which need to be rendered.
689687
///
690688
/// The rendering driver uses this closure to queue up more work.
691-
fn item(&mut self, item: clean::Item, f: |&mut Context, clean::Item|) {
689+
fn item(&mut self, item: clean::Item) {
692690
fn render(w: io::File, cx: &mut Context, it: &clean::Item,
693691
pushname: bool) {
692+
info!("Rendering an item to {}", w.path().display());
694693
// A little unfortunate that this is done like this, but it sure
695694
// does make formatting *a lot* nicer.
696695
local_data::set(current_location_key, cx.current.clone());
@@ -734,7 +733,7 @@ impl Context {
734733
};
735734
this.sidebar = build_sidebar(&m);
736735
for item in m.items.move_iter() {
737-
f(this, item);
736+
this.item(item);
738737
}
739738
})
740739
}

0 commit comments

Comments
 (0)