diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustdoc/clean/mod.rs | 14 | ||||
| -rw-r--r-- | src/librustdoc/clean/types.rs | 6 | ||||
| -rw-r--r-- | src/librustdoc/core.rs | 10 |
3 files changed, 18 insertions, 12 deletions
diff --git a/src/librustdoc/clean/mod.rs b/src/librustdoc/clean/mod.rs index 89977934cde..efe2816fbe6 100644 --- a/src/librustdoc/clean/mod.rs +++ b/src/librustdoc/clean/mod.rs @@ -1796,7 +1796,7 @@ fn maybe_expand_private_type_alias<'tcx>( } else { Lifetime::elided() }; - args.insert(param.def_id.to_def_id(), SubstParam::Lifetime(cleaned)); + args.insert(param.def_id.to_def_id(), InstantiationParam::Lifetime(cleaned)); } indices.lifetimes += 1; } @@ -1813,9 +1813,15 @@ fn maybe_expand_private_type_alias<'tcx>( _ => None, }); if let Some(ty) = type_ { - args.insert(param.def_id.to_def_id(), SubstParam::Type(clean_ty(ty, cx))); + args.insert( + param.def_id.to_def_id(), + InstantiationParam::Type(clean_ty(ty, cx)), + ); } else if let Some(default) = *default { - args.insert(param.def_id.to_def_id(), SubstParam::Type(clean_ty(default, cx))); + args.insert( + param.def_id.to_def_id(), + InstantiationParam::Type(clean_ty(default, cx)), + ); } indices.types += 1; } @@ -1832,7 +1838,7 @@ fn maybe_expand_private_type_alias<'tcx>( _ => None, }); if let Some(_) = const_ { - args.insert(param.def_id.to_def_id(), SubstParam::Constant); + args.insert(param.def_id.to_def_id(), InstantiationParam::Constant); } // FIXME(const_generics_defaults) indices.consts += 1; diff --git a/src/librustdoc/clean/types.rs b/src/librustdoc/clean/types.rs index 6710193f961..96b4d1a45f6 100644 --- a/src/librustdoc/clean/types.rs +++ b/src/librustdoc/clean/types.rs @@ -2542,14 +2542,14 @@ pub(crate) enum TypeBindingKind { /// ``` /// /// `public_fn`'s docs will show it as returning `Vec<i32>`, since `PrivAlias` is private. -/// [`SubstParam`] is used to record that `T` should be mapped to `i32`. -pub(crate) enum SubstParam { +/// [`InstantiationParam`] is used to record that `T` should be mapped to `i32`. +pub(crate) enum InstantiationParam { Type(Type), Lifetime(Lifetime), Constant, } -impl SubstParam { +impl InstantiationParam { pub(crate) fn as_ty(&self) -> Option<&Type> { if let Self::Type(ty) = self { Some(ty) } else { None } } diff --git a/src/librustdoc/core.rs b/src/librustdoc/core.rs index 9eb62c25892..28ccda39e4d 100644 --- a/src/librustdoc/core.rs +++ b/src/librustdoc/core.rs @@ -44,10 +44,10 @@ pub(crate) struct DocContext<'tcx> { /// Used while populating `external_traits` to ensure we don't process the same trait twice at /// the same time. pub(crate) active_extern_traits: DefIdSet, - // The current set of parameter substitutions, + // The current set of parameter instantiations, // for expanding type aliases at the HIR level: - /// Table `DefId` of type, lifetime, or const parameter -> substituted type, lifetime, or const - pub(crate) args: DefIdMap<clean::SubstParam>, + /// Table `DefId` of type, lifetime, or const parameter -> instantiated type, lifetime, or const + pub(crate) args: DefIdMap<clean::InstantiationParam>, pub(crate) current_type_aliases: DefIdMap<usize>, /// Table synthetic type parameter for `impl Trait` in argument position -> bounds pub(crate) impl_trait_bounds: FxHashMap<ImplTraitParam, Vec<clean::GenericBound>>, @@ -84,10 +84,10 @@ impl<'tcx> DocContext<'tcx> { } /// Call the closure with the given parameters set as - /// the substitutions for a type alias' RHS. + /// the generic parameters for a type alias' RHS. pub(crate) fn enter_alias<F, R>( &mut self, - args: DefIdMap<clean::SubstParam>, + args: DefIdMap<clean::InstantiationParam>, def_id: DefId, f: F, ) -> R |
