@@ -678,15 +678,21 @@ impl Context {
678678 // using a rwarc makes this parallelizable in the future
679679 local_data:: set ( cache_key, Arc :: new ( cache) ) ;
680680
681- self . item ( item) ;
681+ let mut work = ~[ ( self , item) ] ;
682+ while work. len ( ) > 0 {
683+ let ( mut cx, item) = work. pop ( ) ;
684+ cx. item ( item, |cx, item| {
685+ work. push ( ( cx. clone ( ) , item) ) ;
686+ } )
687+ }
682688 }
683689
684690 /// Non-parellelized version of rendering an item. This will take the input
685691 /// item, render its contents, and then invoke the specified closure with
686692 /// all sub-items which need to be rendered.
687693 ///
688694 /// The rendering driver uses this closure to queue up more work.
689- fn item ( & mut self , item : clean:: Item ) {
695+ fn item ( & mut self , item : clean:: Item , f : | & mut Context , clean :: Item | ) {
690696 fn render ( w : io:: File , cx : & mut Context , it : & clean:: Item ,
691697 pushname : bool ) {
692698 info ! ( "Rendering an item to {}" , w. path( ) . display( ) ) ;
@@ -733,7 +739,7 @@ impl Context {
733739 } ;
734740 this. sidebar = build_sidebar ( & m) ;
735741 for item in m. items . move_iter ( ) {
736- this . item ( item) ;
742+ f ( this , item) ;
737743 }
738744 } )
739745 }
0 commit comments