@@ -54,14 +54,10 @@ crate struct DocContext<'tcx> {
54
54
/// Used while populating `external_traits` to ensure we don't process the same trait twice at
55
55
/// the same time.
56
56
crate active_extern_traits : FxHashSet < DefId > ,
57
- // The current set of type and lifetime substitutions,
57
+ // The current set of parameter substitutions,
58
58
// 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 > ,
65
61
/// Table synthetic type parameter for `impl Trait` in argument position -> bounds
66
62
crate impl_trait_bounds : FxHashMap < ImplTraitParam , Vec < clean:: GenericBound > > ,
67
63
/// Auto-trait or blanket impls processed so far, as `(self_ty, trait_def_id)`.
@@ -104,25 +100,13 @@ impl<'tcx> DocContext<'tcx> {
104
100
105
101
/// Call the closure with the given parameters set as
106
102
/// 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
114
104
where
115
105
F : FnOnce ( & mut Self ) -> R ,
116
106
{
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) ;
122
108
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;
126
110
r
127
111
}
128
112
@@ -350,9 +334,7 @@ crate fn run_global_ctxt(
350
334
param_env : ParamEnv :: empty ( ) ,
351
335
external_traits : Default :: default ( ) ,
352
336
active_extern_traits : Default :: default ( ) ,
353
- ty_substs : Default :: default ( ) ,
354
- lt_substs : Default :: default ( ) ,
355
- ct_substs : Default :: default ( ) ,
337
+ substs : Default :: default ( ) ,
356
338
impl_trait_bounds : Default :: default ( ) ,
357
339
generated_synthetics : Default :: default ( ) ,
358
340
auto_traits : tcx
0 commit comments