diff --git a/src/librustdoc/clean/utils.rs b/src/librustdoc/clean/utils.rs index 1a1755ea38c..3a83f4505a5 100644 --- a/src/librustdoc/clean/utils.rs +++ b/src/librustdoc/clean/utils.rs @@ -397,10 +397,10 @@ fn print_const_with_custom_print_scalar(tcx: TyCtxt<'_>, ct: &ty::Const<'_>) -> | Union | Mod | ForeignTy | Const | Static | Macro(..) | TraitAlias), i, ) => (i, kind.into()), - // This is part of a trait definition; document the trait. + // This is part of a trait definition or trait impl; document the trait. Res::SelfTy { trait_: Some(trait_def_id), alias_to: _ } => (trait_def_id, ItemType::Trait), - // This is an inherent impl; it doesn't have its own page. - Res::SelfTy { trait_: None, alias_to: Some((impl_def_id, _)) } => return impl_def_id, + // This is an inherent impl or a type definition; it doesn't have its own page. + Res::SelfTy { trait_: None, alias_to: Some((item_def_id, _)) } => return item_def_id, Res::SelfTy { trait_: None, alias_to: None } | Res::PrimTy(_) | Res::ToolMod