@@ -49,8 +49,6 @@ crate struct DocContext<'tcx> {
49
49
///
50
50
/// Most of this logic is copied from rustc_lint::late.
51
51
crate param_env : Cell < ParamEnv < ' tcx > > ,
52
- /// Later on moved into `cache`
53
- crate renderinfo : RefCell < RenderInfo > ,
54
52
/// Later on moved through `clean::Crate` into `cache`
55
53
crate external_traits : Rc < RefCell < FxHashMap < DefId , clean:: Trait > > > ,
56
54
/// Used while populating `external_traits` to ensure we don't process the same trait twice at
@@ -78,8 +76,12 @@ crate struct DocContext<'tcx> {
78
76
/// See `collect_intra_doc_links::traits_implemented_by` for more details.
79
77
/// `map<module, set<trait>>`
80
78
crate module_trait_cache : RefCell < FxHashMap < DefId , FxHashSet < DefId > > > ,
81
- /// Fake empty cache used when cache is required as parameter.
82
- crate cache : Cache ,
79
+ /// This same cache is used throughout rustdoc, including in `render`.
80
+ crate cache : RefCell < Cache > ,
81
+ /// Used by `clean::inline` to tell if an item has already been inlined.
82
+ crate inlined : RefCell < FxHashSet < DefId > > ,
83
+ /// Used by `calculate_doc_coverage`.
84
+ crate output_format : OutputFormat ,
83
85
}
84
86
85
87
impl < ' tcx > DocContext < ' tcx > {
@@ -464,7 +466,7 @@ crate fn run_global_ctxt(
464
466
mut manual_passes : Vec < String > ,
465
467
render_options : RenderOptions ,
466
468
output_format : OutputFormat ,
467
- ) -> ( clean:: Crate , RenderInfo , RenderOptions ) {
469
+ ) -> ( clean:: Crate , RenderOptions , Cache ) {
468
470
// Certain queries assume that some checks were run elsewhere
469
471
// (see https://github.com/rust-lang/rust/pull/73566#issuecomment-656954425),
470
472
// so type-check everything other than function bodies in this crate before running lints.
@@ -514,7 +516,6 @@ crate fn run_global_ctxt(
514
516
param_env : Cell :: new ( ParamEnv :: empty ( ) ) ,
515
517
external_traits : Default :: default ( ) ,
516
518
active_extern_traits : Default :: default ( ) ,
517
- renderinfo : RefCell :: new ( renderinfo) ,
518
519
ty_substs : Default :: default ( ) ,
519
520
lt_substs : Default :: default ( ) ,
520
521
ct_substs : Default :: default ( ) ,
@@ -527,9 +528,11 @@ crate fn run_global_ctxt(
527
528
. cloned ( )
528
529
. filter ( |trait_def_id| tcx. trait_is_auto ( * trait_def_id) )
529
530
. collect ( ) ,
530
- render_options,
531
531
module_trait_cache : RefCell :: new ( FxHashMap :: default ( ) ) ,
532
- cache : Cache :: default ( ) ,
532
+ cache : RefCell :: new ( Cache :: new ( renderinfo, render_options. document_private ) ) ,
533
+ inlined : RefCell :: new ( FxHashSet :: default ( ) ) ,
534
+ output_format,
535
+ render_options,
533
536
} ;
534
537
debug ! ( "crate: {:?}" , tcx. hir( ) . krate( ) ) ;
535
538
@@ -634,10 +637,17 @@ crate fn run_global_ctxt(
634
637
635
638
ctxt. sess ( ) . abort_if_errors ( ) ;
636
639
640
+ let render_options = ctxt. render_options ;
641
+ let mut cache = ctxt. cache . into_inner ( ) ;
642
+
643
+ krate = tcx. sess . time ( "create_format_cache" , || {
644
+ cache. populate ( krate, tcx, & render_options. extern_html_root_urls , & render_options. output )
645
+ } ) ;
646
+
637
647
// The main crate doc comments are always collapsed.
638
648
krate. collapsed = true ;
639
649
640
- ( krate, ctxt . renderinfo . into_inner ( ) , ctxt . render_options )
650
+ ( krate, render_options , cache )
641
651
}
642
652
643
653
/// Due to <https://github.com/rust-lang/rust/pull/73566>,
0 commit comments