Skip to content

Commit a4d1807

Browse files
Rustdoc support
1 parent 4265ef8 commit a4d1807

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

src/librustdoc/clean/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1500,6 +1500,16 @@ pub(crate) fn clean_ty<'tcx>(ty: &hir::Ty<'tcx>, cx: &mut DocContext<'tcx>) -> T
15001500
unreachable!()
15011501
}
15021502
}
1503+
TyKind::ImplTraitInTrait(item_id) => {
1504+
let item = cx.tcx.hir().item(item_id);
1505+
if let hir::ItemKind::ImplTraitPlaceholder(hir::ImplTraitPlaceholder { bounds }) =
1506+
item.kind
1507+
{
1508+
ImplTrait(bounds.iter().filter_map(|x| clean_generic_bound(x, cx)).collect())
1509+
} else {
1510+
unreachable!()
1511+
}
1512+
}
15031513
TyKind::Path(_) => clean_qpath(ty, cx),
15041514
TyKind::TraitObject(bounds, ref lifetime, _) => {
15051515
let bounds = bounds.iter().map(|bound| clean_poly_trait_ref(bound, cx)).collect();

src/librustdoc/formats/item_type.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ impl From<DefKind> for ItemType {
135135
| DefKind::AnonConst
136136
| DefKind::InlineConst
137137
| DefKind::OpaqueTy
138+
| DefKind::ImplTraitPlaceholder
138139
| DefKind::Field
139140
| DefKind::LifetimeParam
140141
| DefKind::GlobalAsm

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1805,8 +1805,8 @@ fn resolution_failure(
18051805
}
18061806
return;
18071807
}
1808-
Trait | TyAlias | ForeignTy | OpaqueTy | TraitAlias | TyParam
1809-
| Static(_) => "associated item",
1808+
Trait | TyAlias | ForeignTy | OpaqueTy | ImplTraitPlaceholder
1809+
| TraitAlias | TyParam | Static(_) => "associated item",
18101810
Impl | GlobalAsm => unreachable!("not a path"),
18111811
}
18121812
} else {

src/librustdoc/visit_ast.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ impl<'a, 'tcx> RustdocVisitor<'a, 'tcx> {
362362
| hir::ItemKind::Union(..)
363363
| hir::ItemKind::TyAlias(..)
364364
| hir::ItemKind::OpaqueTy(..)
365+
| hir::ItemKind::ImplTraitPlaceholder(..)
365366
| hir::ItemKind::Static(..)
366367
| hir::ItemKind::Trait(..)
367368
| hir::ItemKind::TraitAlias(..) => om.items.push((item, renamed)),

0 commit comments

Comments
 (0)