Skip to content

Commit 61b0cf7

Browse files
Add TyKind::TyAlias support in librustdoc
1 parent 2e215cd commit 61b0cf7

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

src/librustdoc/clean/inline.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ fn build_union(cx: &mut DocContext<'_>, did: DefId) -> clean::Union {
297297
clean::Union { generics, fields }
298298
}
299299

300-
fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> Box<clean::Typedef> {
300+
pub(crate) fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> Box<clean::Typedef> {
301301
let predicates = cx.tcx.explicit_predicates_of(did);
302302
let type_ = clean_middle_ty(cx.tcx.type_of(did), cx, Some(did));
303303

src/librustdoc/clean/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1733,6 +1733,11 @@ pub(crate) fn clean_middle_ty<'tcx>(
17331733
clean_middle_opaque_bounds(cx, bounds)
17341734
}
17351735

1736+
ty::TyAlias(def_id, substs) => {
1737+
let path = external_path(cx, def_id, false, ThinVec::new(), substs);
1738+
Type::Path { path }
1739+
}
1740+
17361741
ty::Closure(..) => panic!("Closure"),
17371742
ty::Generator(..) => panic!("Generator"),
17381743
ty::Bound(..) => panic!("Bound"),

src/librustdoc/passes/collect_intra_doc_links.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,7 @@ impl<'a, 'tcx> LinkCollector<'a, 'tcx> {
537537
ty::Adt(ty::AdtDef(Interned(&ty::AdtDefData { did, .. }, _)), _) | ty::Foreign(did) => {
538538
Res::from_def_id(self.cx.tcx, did)
539539
}
540+
ty::TyAlias(def_id, _) => Res::Def(self.cx.tcx.def_kind(def_id), def_id),
540541
ty::Projection(_)
541542
| ty::Closure(..)
542543
| ty::Generator(..)

0 commit comments

Comments
 (0)