1
Fork 0

Fix deref impl on type alias

This commit is contained in:
Guillaume Gomez 2020-01-10 02:07:13 +01:00
parent bf84eb538f
commit 12f029b7ee
5 changed files with 90 additions and 27 deletions

View file

@ -1122,7 +1122,16 @@ impl Clean<Item> for hir::ImplItem<'_> {
MethodItem((sig, &self.generics, body, Some(self.defaultness)).clean(cx))
}
hir::ImplItemKind::TyAlias(ref ty) => {
TypedefItem(Typedef { type_: ty.clean(cx), generics: Generics::default() }, true)
let type_ = ty.clean(cx);
let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did));
TypedefItem(
Typedef {
type_,
generics: Generics::default(),
item_type,
},
true,
)
}
hir::ImplItemKind::OpaqueTy(ref bounds) => OpaqueTyItem(
OpaqueTy { bounds: bounds.clean(cx), generics: Generics::default() },
@ -1282,10 +1291,13 @@ impl Clean<Item> for ty::AssocItem {
AssocTypeItem(bounds, ty.clean(cx))
} else {
let type_ = cx.tcx.type_of(self.def_id).clean(cx);
let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did));
TypedefItem(
Typedef {
type_: cx.tcx.type_of(self.def_id).clean(cx),
type_,
generics: Generics { params: Vec::new(), where_predicates: Vec::new() },
item_type,
},
true,
)
@ -1989,6 +2001,8 @@ impl Clean<String> for ast::Name {
impl Clean<Item> for doctree::Typedef<'_> {
fn clean(&self, cx: &DocContext<'_>) -> Item {
let type_ = self.ty.clean(cx);
let item_type = type_.def_id().and_then(|did| inline::build_ty(cx, did));
Item {
name: Some(self.name.clean(cx)),
attrs: self.attrs.clean(cx),
@ -1998,7 +2012,11 @@ impl Clean<Item> for doctree::Typedef<'_> {
stability: cx.stability(self.id).clean(cx),
deprecation: cx.deprecation(self.id).clean(cx),
inner: TypedefItem(
Typedef { type_: self.ty.clean(cx), generics: self.gen.clean(cx) },
Typedef {
type_,
generics: self.gen.clean(cx),
item_type,
},
false,
),
}