@@ -54,14 +54,10 @@ crate struct DocContext<'tcx> {
5454 /// Used while populating `external_traits` to ensure we don't process the same trait twice at
5555 /// the same time.
5656 crate active_extern_traits : FxHashSet < DefId > ,
57- // The current set of type and lifetime substitutions,
57+ // The current set of parameter substitutions,
5858 // for expanding type aliases at the HIR level:
59- /// Table `DefId` of type parameter -> substituted type
60- crate ty_substs : FxHashMap < DefId , clean:: Type > ,
61- /// Table `DefId` of lifetime parameter -> substituted lifetime
62- crate lt_substs : FxHashMap < DefId , clean:: Lifetime > ,
63- /// Table `DefId` of const parameter -> substituted const
64- crate ct_substs : FxHashMap < DefId , clean:: Constant > ,
59+ /// Table `DefId` of type, lifetime, or const parameter -> substituted type, lifetime, or const
60+ crate substs : FxHashMap < DefId , clean:: SubstParam > ,
6561 /// Table synthetic type parameter for `impl Trait` in argument position -> bounds
6662 crate impl_trait_bounds : FxHashMap < ImplTraitParam , Vec < clean:: GenericBound > > ,
6763 /// Auto-trait or blanket impls processed so far, as `(self_ty, trait_def_id)`.
@@ -104,25 +100,13 @@ impl<'tcx> DocContext<'tcx> {
104100
105101 /// Call the closure with the given parameters set as
106102 /// the substitutions for a type alias' RHS.
107- crate fn enter_alias < F , R > (
108- & mut self ,
109- ty_substs : FxHashMap < DefId , clean:: Type > ,
110- lt_substs : FxHashMap < DefId , clean:: Lifetime > ,
111- ct_substs : FxHashMap < DefId , clean:: Constant > ,
112- f : F ,
113- ) -> R
103+ crate fn enter_alias < F , R > ( & mut self , substs : FxHashMap < DefId , clean:: SubstParam > , f : F ) -> R
114104 where
115105 F : FnOnce ( & mut Self ) -> R ,
116106 {
117- let ( old_tys, old_lts, old_cts) = (
118- mem:: replace ( & mut self . ty_substs , ty_substs) ,
119- mem:: replace ( & mut self . lt_substs , lt_substs) ,
120- mem:: replace ( & mut self . ct_substs , ct_substs) ,
121- ) ;
107+ let old_substs = mem:: replace ( & mut self . substs , substs) ;
122108 let r = f ( self ) ;
123- self . ty_substs = old_tys;
124- self . lt_substs = old_lts;
125- self . ct_substs = old_cts;
109+ self . substs = old_substs;
126110 r
127111 }
128112
@@ -350,9 +334,7 @@ crate fn run_global_ctxt(
350334 param_env : ParamEnv :: empty ( ) ,
351335 external_traits : Default :: default ( ) ,
352336 active_extern_traits : Default :: default ( ) ,
353- ty_substs : Default :: default ( ) ,
354- lt_substs : Default :: default ( ) ,
355- ct_substs : Default :: default ( ) ,
337+ substs : Default :: default ( ) ,
356338 impl_trait_bounds : Default :: default ( ) ,
357339 generated_synthetics : Default :: default ( ) ,
358340 auto_traits : tcx
0 commit comments