Rustdoc support

This commit is contained in:
Michael Goulet 2022-08-31 04:41:20 +00:00
parent 4265ef8cb2
commit a4d1807d6d
4 changed files with 14 additions and 2 deletions

View File

@ -1500,6 +1500,16 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
unreachable!()
}
}
TyKind::ImplTraitInTrait(item_id) => {
let item = cx.tcx.hir().item(item_id);
if let hir::ItemKind::ImplTraitPlaceholder(hir::ImplTraitPlaceholder { bounds }) =
item.kind
{
ImplTrait(bounds.iter().filter_map(|x| clean_generic_bound(x, cx)).collect())
} else {
unreachable!()
}
}
TyKind::Path(_) => clean_qpath(ty, cx),
TyKind::TraitObject(bounds, ref lifetime, _) => {
let bounds = bounds.iter().map(|bound| clean_poly_trait_ref(bound, cx)).collect();

View File

@ -135,6 +135,7 @@ impl From<DefKind> for ItemType {
| DefKind::AnonConst
| DefKind::InlineConst
| DefKind::OpaqueTy
| DefKind::ImplTraitPlaceholder
| DefKind::Field
| DefKind::LifetimeParam
| DefKind::GlobalAsm

View File

@ -1805,8 +1805,8 @@ fn resolution_failure(
}
return;
}
Trait | TyAlias | ForeignTy | OpaqueTy | TraitAlias | TyParam
| Static(_) => "associated item",
Trait | TyAlias | ForeignTy | OpaqueTy | ImplTraitPlaceholder
| TraitAlias | TyParam | Static(_) => "associated item",
Impl | GlobalAsm => unreachable!("not a path"),
}
} else {

View File

@ -362,6 +362,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
| hir::ItemKind::Union(..)
| hir::ItemKind::TyAlias(..)
| hir::ItemKind::OpaqueTy(..)
| hir::ItemKind::ImplTraitPlaceholder(..)
| hir::ItemKind::Static(..)
| hir::ItemKind::Trait(..)
| hir::ItemKind::TraitAlias(..) => om.items.push((item, renamed)),