mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Fix rustdoc HTML rendering
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.
This commit is contained in:
parent
793eb1d38d
commit
8b5a317d48
@ -648,9 +648,13 @@ impl Context {
|
|||||||
self.root_path.push_str("../");
|
self.root_path.push_str("../");
|
||||||
self.current.push(s);
|
self.current.push(s);
|
||||||
|
|
||||||
|
info!("Recursing into {}", self.dst.display());
|
||||||
|
|
||||||
mkdir(&self.dst);
|
mkdir(&self.dst);
|
||||||
let ret = f(self);
|
let ret = f(self);
|
||||||
|
|
||||||
|
info!("Recursed; leaving {}", self.dst.display());
|
||||||
|
|
||||||
// Go back to where we were at
|
// Go back to where we were at
|
||||||
self.dst = prev;
|
self.dst = prev;
|
||||||
let len = self.root_path.len();
|
let len = self.root_path.len();
|
||||||
@ -674,13 +678,7 @@ impl Context {
|
|||||||
// using a rwarc makes this parallelizable in the future
|
// using a rwarc makes this parallelizable in the future
|
||||||
local_data::set(cache_key, Arc::new(cache));
|
local_data::set(cache_key, Arc::new(cache));
|
||||||
|
|
||||||
let mut work = ~[item];
|
self.item(item);
|
||||||
while work.len() > 0 {
|
|
||||||
let item = work.pop();
|
|
||||||
self.item(item, |_cx, item| {
|
|
||||||
work.push(item);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Non-parellelized version of rendering an item. This will take the input
|
/// Non-parellelized version of rendering an item. This will take the input
|
||||||
@ -688,9 +686,10 @@ impl Context {
|
|||||||
/// all sub-items which need to be rendered.
|
/// all sub-items which need to be rendered.
|
||||||
///
|
///
|
||||||
/// The rendering driver uses this closure to queue up more work.
|
/// The rendering driver uses this closure to queue up more work.
|
||||||
fn item(&mut self, item: clean::Item, f: |&mut Context, clean::Item|) {
|
fn item(&mut self, item: clean::Item) {
|
||||||
fn render(w: io::File, cx: &mut Context, it: &clean::Item,
|
fn render(w: io::File, cx: &mut Context, it: &clean::Item,
|
||||||
pushname: bool) {
|
pushname: bool) {
|
||||||
|
info!("Rendering an item to {}", w.path().display());
|
||||||
// A little unfortunate that this is done like this, but it sure
|
// A little unfortunate that this is done like this, but it sure
|
||||||
// does make formatting *a lot* nicer.
|
// does make formatting *a lot* nicer.
|
||||||
local_data::set(current_location_key, cx.current.clone());
|
local_data::set(current_location_key, cx.current.clone());
|
||||||
@ -734,7 +733,7 @@ impl Context {
|
|||||||
};
|
};
|
||||||
this.sidebar = build_sidebar(&m);
|
this.sidebar = build_sidebar(&m);
|
||||||
for item in m.items.move_iter() {
|
for item in m.items.move_iter() {
|
||||||
f(this, item);
|
this.item(item);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user