about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Richardson <corey@octayn.net>2013-12-18 12:26:19 -0500
committerCorey Richardson <corey@octayn.net>2013-12-18 15:21:34 -0500
commit21bec4f11bd66f9ff7e74eb878efe3d487057329 (patch)
tree15504b229ab42e55ecaafdf9a90b0e83b4c45e50
parent5d45170b02fc3055f9a80d06f7ab1f508c8de98f (diff)
rustdoc: thread through the context for rendering
This partially reverts 8b5a317.
-rw-r--r--src/librustdoc/html/render.rs12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/librustdoc/html/render.rs b/src/librustdoc/html/render.rs
index 3d2e03785ed..c84caf8acdd 100644
--- a/src/librustdoc/html/render.rs
+++ b/src/librustdoc/html/render.rs
@@ -678,7 +678,13 @@ impl Context {
         // using a rwarc makes this parallelizable in the future
         local_data::set(cache_key, Arc::new(cache));
 
-        self.item(item);
+        let mut work = ~[(self, item)];
+        while work.len() > 0 {
+            let (mut cx, item) = work.pop();
+            cx.item(item, |cx, item| {
+                work.push((cx.clone(), item));
+            })
+        }
     }
 
     /// Non-parellelized version of rendering an item. This will take the input
@@ -686,7 +692,7 @@ impl Context {
     /// all sub-items which need to be rendered.
     ///
     /// The rendering driver uses this closure to queue up more work.
-    fn item(&mut self, item: clean::Item) {
+    fn item(&mut self, item: clean::Item, f: |&mut Context, clean::Item|) {
         fn render(w: io::File, cx: &mut Context, it: &clean::Item,
                   pushname: bool) {
             info!("Rendering an item to {}", w.path().display());
@@ -733,7 +739,7 @@ impl Context {
                     };
                     this.sidebar = build_sidebar(&m);
                     for item in m.items.move_iter() {
-                        this.item(item);
+                        f(this,item);
                     }
                 })
             }