@@ -90,6 +90,7 @@ mod theme;
90
90
struct Output {
91
91
krate : clean:: Crate ,
92
92
renderinfo : html:: render:: RenderInfo ,
93
+ renderopts : config:: RenderOptions ,
93
94
passes : Vec < String > ,
94
95
}
95
96
@@ -381,36 +382,38 @@ fn main_args(args: &[String]) -> isize {
381
382
options. display_warnings , options. linker , options. edition ,
382
383
options. codegen_options )
383
384
}
384
- ( false , true ) => return markdown:: render ( & options. input , options. output ,
385
- & options. markdown_css ,
386
- options. markdown_playground_url
387
- . or ( options. playground_url ) ,
388
- & options. external_html ,
389
- !options. markdown_no_toc , & diag) ,
385
+ ( false , true ) => return markdown:: render ( & options. input , options. render_options . output ,
386
+ & options. render_options . markdown_css ,
387
+ options. render_options . markdown_playground_url
388
+ . or ( options. render_options . playground_url ) ,
389
+ & options. render_options . external_html ,
390
+ !options. render_options . markdown_no_toc , & diag) ,
390
391
( false , false ) => { }
391
392
}
392
393
393
- //TODO: split render-time options into their own struct so i don't have to clone here
394
- rust_input ( options. clone ( ) , move |out| {
395
- let Output { krate, passes, renderinfo } = out;
394
+ // need to move these items separately because we lose them by the time the closure is called,
395
+ // but we can't crates the Handler ahead of time because it's not Send
396
+ let diag_opts = ( options. error_format ,
397
+ options. debugging_options . treat_err_as_bug ,
398
+ options. debugging_options . ui_testing ) ;
399
+ rust_input ( options, move |out| {
400
+ let Output { krate, passes, renderinfo, renderopts } = out;
396
401
info ! ( "going to format" ) ;
397
- let diag = core:: new_handler ( options. error_format ,
398
- None ,
399
- options. debugging_options . treat_err_as_bug ,
400
- options. debugging_options . ui_testing ) ;
401
- let html_opts = options. clone ( ) ;
402
- html:: render:: run ( krate, options. extern_html_root_urls , & options. external_html , options. playground_url ,
403
- options. output ,
404
- options. resource_suffix ,
402
+ let ( error_format, treat_err_as_bug, ui_testing) = diag_opts;
403
+ let diag = core:: new_handler ( error_format, None , treat_err_as_bug, ui_testing) ;
404
+ let html_opts = renderopts. clone ( ) ;
405
+ html:: render:: run ( krate, renderopts. extern_html_root_urls , & renderopts. external_html ,
406
+ renderopts. playground_url ,
407
+ renderopts. output ,
408
+ renderopts. resource_suffix ,
405
409
passes. into_iter ( ) . collect ( ) ,
406
- options . extension_css ,
410
+ renderopts . extension_css ,
407
411
renderinfo,
408
- options. sort_modules_alphabetically ,
409
- options. themes ,
410
- options. enable_minification , options. id_map ,
411
- options. enable_index_page , options. index_page ,
412
- html_opts,
413
- & diag)
412
+ renderopts. sort_modules_alphabetically ,
413
+ renderopts. themes ,
414
+ renderopts. enable_minification , renderopts. id_map ,
415
+ renderopts. enable_index_page , renderopts. index_page ,
416
+ html_opts, & diag)
414
417
. expect ( "failed to generate documentation" ) ;
415
418
0
416
419
} )
@@ -482,7 +485,12 @@ where R: 'static + Send,
482
485
krate = pass ( krate) ;
483
486
}
484
487
485
- tx. send ( f ( Output { krate : krate, renderinfo : renderinfo, passes : passes } ) ) . unwrap ( ) ;
488
+ tx. send ( f ( Output {
489
+ krate : krate,
490
+ renderinfo : renderinfo,
491
+ renderopts : options. render_options ,
492
+ passes : passes
493
+ } ) ) . unwrap ( ) ;
486
494
} ) ) ;
487
495
488
496
match result {
0 commit comments