@@ -47,8 +47,6 @@ crate struct DocContext<'tcx> {
47
47
///
48
48
/// Most of this logic is copied from rustc_lint::late.
49
49
crate param_env : ParamEnv < ' tcx > ,
50
- /// Later on moved into `cache`
51
- crate renderinfo : RefCell < RenderInfo > ,
52
50
/// Later on moved through `clean::Crate` into `cache`
53
51
crate external_traits : Rc < RefCell < FxHashMap < DefId , clean:: Trait > > > ,
54
52
/// Used while populating `external_traits` to ensure we don't process the same trait twice at
@@ -76,8 +74,12 @@ crate struct DocContext<'tcx> {
76
74
/// See `collect_intra_doc_links::traits_implemented_by` for more details.
77
75
/// `map<module, set<trait>>`
78
76
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` .
80
78
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 ,
81
83
}
82
84
83
85
impl < ' tcx > DocContext < ' tcx > {
@@ -460,7 +462,7 @@ crate fn run_global_ctxt(
460
462
mut manual_passes : Vec < String > ,
461
463
render_options : RenderOptions ,
462
464
output_format : OutputFormat ,
463
- ) -> ( clean:: Crate , RenderInfo , RenderOptions ) {
465
+ ) -> ( clean:: Crate , RenderOptions , Cache ) {
464
466
// Certain queries assume that some checks were run elsewhere
465
467
// (see https://github.com/rust-lang/rust/pull/73566#issuecomment-656954425),
466
468
// so type-check everything other than function bodies in this crate before running lints.
@@ -509,7 +511,6 @@ crate fn run_global_ctxt(
509
511
param_env : ParamEnv :: empty ( ) ,
510
512
external_traits : Default :: default ( ) ,
511
513
active_extern_traits : Default :: default ( ) ,
512
- renderinfo : RefCell :: new ( renderinfo) ,
513
514
ty_substs : Default :: default ( ) ,
514
515
lt_substs : Default :: default ( ) ,
515
516
ct_substs : Default :: default ( ) ,
@@ -522,9 +523,11 @@ crate fn run_global_ctxt(
522
523
. cloned ( )
523
524
. filter ( |trait_def_id| tcx. trait_is_auto ( * trait_def_id) )
524
525
. collect ( ) ,
525
- render_options,
526
526
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,
528
531
} ;
529
532
530
533
// Small hack to force the Sized trait to be present.
@@ -639,10 +642,16 @@ crate fn run_global_ctxt(
639
642
640
643
ctxt. sess ( ) . abort_if_errors ( ) ;
641
644
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
+
642
651
// The main crate doc comments are always collapsed.
643
652
krate. collapsed = true ;
644
653
645
- ( krate, ctxt . renderinfo . into_inner ( ) , ctxt . render_options )
654
+ ( krate, render_options , cache )
646
655
}
647
656
648
657
/// Due to <https://github.com/rust-lang/rust/pull/73566>,
0 commit comments