@@ -47,8 +47,6 @@ crate struct DocContext<'tcx> {
4747 ///
4848 /// Most of this logic is copied from rustc_lint::late.
4949 crate param_env : ParamEnv < ' tcx > ,
50- /// Later on moved into `cache`
51- crate renderinfo : RefCell < RenderInfo > ,
5250 /// Later on moved through `clean::Crate` into `cache`
5351 crate external_traits : Rc < RefCell < FxHashMap < DefId , clean:: Trait > > > ,
5452 /// Used while populating `external_traits` to ensure we don't process the same trait twice at
@@ -76,8 +74,12 @@ crate struct DocContext<'tcx> {
7674 /// See `collect_intra_doc_links::traits_implemented_by` for more details.
7775 /// `map<module, set<trait>>`
7876 crate module_trait_cache : RefCell < FxHashMap < DefId , FxHashSet < DefId > > > ,
79- /// Fake empty cache used when cache is required as parameter .
77+ /// This same cache is used throughout rustdoc, including in `render` .
8078 crate cache : Cache ,
79+ /// Used by `clean::inline` to tell if an item has already been inlined.
80+ crate inlined : RefCell < FxHashSet < DefId > > ,
81+ /// Used by `calculate_doc_coverage`.
82+ crate output_format : OutputFormat ,
8183}
8284
8385impl < ' tcx > DocContext < ' tcx > {
@@ -460,7 +462,7 @@ crate fn run_global_ctxt(
460462 mut manual_passes : Vec < String > ,
461463 render_options : RenderOptions ,
462464 output_format : OutputFormat ,
463- ) -> ( clean:: Crate , RenderInfo , RenderOptions ) {
465+ ) -> ( clean:: Crate , RenderOptions , Cache ) {
464466 // Certain queries assume that some checks were run elsewhere
465467 // (see https://github.com/rust-lang/rust/pull/73566#issuecomment-656954425),
466468 // so type-check everything other than function bodies in this crate before running lints.
@@ -509,7 +511,6 @@ crate fn run_global_ctxt(
509511 param_env : ParamEnv :: empty ( ) ,
510512 external_traits : Default :: default ( ) ,
511513 active_extern_traits : Default :: default ( ) ,
512- renderinfo : RefCell :: new ( renderinfo) ,
513514 ty_substs : Default :: default ( ) ,
514515 lt_substs : Default :: default ( ) ,
515516 ct_substs : Default :: default ( ) ,
@@ -522,9 +523,11 @@ crate fn run_global_ctxt(
522523 . cloned ( )
523524 . filter ( |trait_def_id| tcx. trait_is_auto ( * trait_def_id) )
524525 . collect ( ) ,
525- render_options,
526526 module_trait_cache : RefCell :: new ( FxHashMap :: default ( ) ) ,
527- cache : Cache :: default ( ) ,
527+ cache : Cache :: new ( renderinfo, render_options. document_private ) ,
528+ inlined : RefCell :: new ( FxHashSet :: default ( ) ) ,
529+ output_format,
530+ render_options,
528531 } ;
529532
530533 // Small hack to force the Sized trait to be present.
@@ -639,10 +642,16 @@ crate fn run_global_ctxt(
639642
640643 ctxt. sess ( ) . abort_if_errors ( ) ;
641644
645+ let render_options = ctxt. render_options ;
646+ let mut cache = ctxt. cache ;
647+ krate = tcx. sess . time ( "create_format_cache" , || {
648+ cache. populate ( krate, tcx, & render_options. extern_html_root_urls , & render_options. output )
649+ } ) ;
650+
642651 // The main crate doc comments are always collapsed.
643652 krate. collapsed = true ;
644653
645- ( krate, ctxt . renderinfo . into_inner ( ) , ctxt . render_options )
654+ ( krate, render_options , cache )
646655}
647656
648657/// Due to <https://github.com/rust-lang/rust/pull/73566>,
0 commit comments