@@ -42,32 +42,37 @@ crate type ExternalPaths = FxHashMap<DefId, (Vec<String>, clean::TypeKind)>;
4242
4343crate struct DocContext < ' tcx > {
4444 crate tcx : TyCtxt < ' tcx > ,
45+ /// Name resolver. Used for intra-doc links.
46+ ///
47+ /// The `Rc<RefCell<...>>` wrapping is needed because that is what's returned by
48+ /// [`Queries::expansion()`].
49+ // FIXME: see if we can get rid of this RefCell somehow
4550 crate resolver : Rc < RefCell < interface:: BoxedResolver > > ,
4651 /// Used for normalization.
4752 ///
4853 /// Most of this logic is copied from rustc_lint::late.
4954 crate param_env : ParamEnv < ' tcx > ,
5055 /// Later on moved into `cache`
51- crate renderinfo : RefCell < RenderInfo > ,
56+ crate renderinfo : RenderInfo ,
5257 /// Later on moved through `clean::Crate` into `cache`
5358 crate external_traits : Rc < RefCell < FxHashMap < DefId , clean:: Trait > > > ,
5459 /// Used while populating `external_traits` to ensure we don't process the same trait twice at
5560 /// the same time.
56- crate active_extern_traits : RefCell < FxHashSet < DefId > > ,
61+ crate active_extern_traits : FxHashSet < DefId > ,
5762 // The current set of type and lifetime substitutions,
5863 // for expanding type aliases at the HIR level:
5964 /// Table `DefId` of type parameter -> substituted type
60- crate ty_substs : RefCell < FxHashMap < DefId , clean:: Type > > ,
65+ crate ty_substs : FxHashMap < DefId , clean:: Type > ,
6166 /// Table `DefId` of lifetime parameter -> substituted lifetime
62- crate lt_substs : RefCell < FxHashMap < DefId , clean:: Lifetime > > ,
67+ crate lt_substs : FxHashMap < DefId , clean:: Lifetime > ,
6368 /// Table `DefId` of const parameter -> substituted const
64- crate ct_substs : RefCell < FxHashMap < DefId , clean:: Constant > > ,
69+ crate ct_substs : FxHashMap < DefId , clean:: Constant > ,
6570 /// Table synthetic type parameter for `impl Trait` in argument position -> bounds
66- crate impl_trait_bounds : RefCell < FxHashMap < ImplTraitParam , Vec < clean:: GenericBound > > > ,
71+ crate impl_trait_bounds : FxHashMap < ImplTraitParam , Vec < clean:: GenericBound > > ,
6772 crate fake_def_ids : FxHashMap < CrateNum , DefIndex > ,
6873 /// Auto-trait or blanket impls processed so far, as `(self_ty, trait_def_id)`.
6974 // FIXME(eddyb) make this a `ty::TraitRef<'tcx>` set.
70- crate generated_synthetics : RefCell < FxHashSet < ( Ty < ' tcx > , DefId ) > > ,
75+ crate generated_synthetics : FxHashSet < ( Ty < ' tcx > , DefId ) > ,
7176 crate auto_traits : Vec < DefId > ,
7277 /// The options given to rustdoc that could be relevant to a pass.
7378 crate render_options : RenderOptions ,
@@ -112,14 +117,14 @@ impl<'tcx> DocContext<'tcx> {
112117 F : FnOnce ( & mut Self ) -> R ,
113118 {
114119 let ( old_tys, old_lts, old_cts) = (
115- mem:: replace ( & mut * self . ty_substs . get_mut ( ) , ty_substs) ,
116- mem:: replace ( & mut * self . lt_substs . get_mut ( ) , lt_substs) ,
117- mem:: replace ( & mut * self . ct_substs . get_mut ( ) , ct_substs) ,
120+ mem:: replace ( & mut self . ty_substs , ty_substs) ,
121+ mem:: replace ( & mut self . lt_substs , lt_substs) ,
122+ mem:: replace ( & mut self . ct_substs , ct_substs) ,
118123 ) ;
119124 let r = f ( self ) ;
120- * self . ty_substs . get_mut ( ) = old_tys;
121- * self . lt_substs . get_mut ( ) = old_lts;
122- * self . ct_substs . get_mut ( ) = old_cts;
125+ self . ty_substs = old_tys;
126+ self . lt_substs = old_lts;
127+ self . ct_substs = old_cts;
123128 r
124129 }
125130
@@ -509,7 +514,7 @@ crate fn run_global_ctxt(
509514 param_env : ParamEnv :: empty ( ) ,
510515 external_traits : Default :: default ( ) ,
511516 active_extern_traits : Default :: default ( ) ,
512- renderinfo : RefCell :: new ( renderinfo ) ,
517+ renderinfo,
513518 ty_substs : Default :: default ( ) ,
514519 lt_substs : Default :: default ( ) ,
515520 ct_substs : Default :: default ( ) ,
@@ -642,7 +647,7 @@ crate fn run_global_ctxt(
642647 // The main crate doc comments are always collapsed.
643648 krate. collapsed = true ;
644649
645- ( krate, ctxt. renderinfo . into_inner ( ) , ctxt. render_options )
650+ ( krate, ctxt. renderinfo , ctxt. render_options )
646651}
647652
648653/// Due to <https://github.com/rust-lang/rust/pull/73566>,
0 commit comments