@@ -1122,7 +1122,9 @@ impl Clean<Item> for hir::ImplItem<'_> {
11221122 MethodItem ( ( sig, & self . generics , body, Some ( self . defaultness ) ) . clean ( cx) )
11231123 }
11241124 hir:: ImplItemKind :: TyAlias ( ref ty) => {
1125- TypedefItem ( Typedef { type_ : ty. clean ( cx) , generics : Generics :: default ( ) } , true )
1125+ let type_ = ty. clean ( cx) ;
1126+ let item_type = type_. def_id ( ) . and_then ( |did| inline:: build_ty ( cx, did) ) ;
1127+ TypedefItem ( Typedef { type_, generics : Generics :: default ( ) , item_type } , true )
11261128 }
11271129 hir:: ImplItemKind :: OpaqueTy ( ref bounds) => OpaqueTyItem (
11281130 OpaqueTy { bounds : bounds. clean ( cx) , generics : Generics :: default ( ) } ,
@@ -1282,10 +1284,13 @@ impl Clean<Item> for ty::AssocItem {
12821284
12831285 AssocTypeItem ( bounds, ty. clean ( cx) )
12841286 } else {
1287+ let type_ = cx. tcx . type_of ( self . def_id ) . clean ( cx) ;
1288+ let item_type = type_. def_id ( ) . and_then ( |did| inline:: build_ty ( cx, did) ) ;
12851289 TypedefItem (
12861290 Typedef {
1287- type_ : cx . tcx . type_of ( self . def_id ) . clean ( cx ) ,
1291+ type_,
12881292 generics : Generics { params : Vec :: new ( ) , where_predicates : Vec :: new ( ) } ,
1293+ item_type,
12891294 } ,
12901295 true ,
12911296 )
@@ -1989,6 +1994,8 @@ impl Clean<String> for ast::Name {
19891994
19901995impl Clean < Item > for doctree:: Typedef < ' _ > {
19911996 fn clean ( & self , cx : & DocContext < ' _ > ) -> Item {
1997+ let type_ = self . ty . clean ( cx) ;
1998+ let item_type = type_. def_id ( ) . and_then ( |did| inline:: build_ty ( cx, did) ) ;
19921999 Item {
19932000 name : Some ( self . name . clean ( cx) ) ,
19942001 attrs : self . attrs . clean ( cx) ,
@@ -1997,10 +2004,7 @@ impl Clean<Item> for doctree::Typedef<'_> {
19972004 visibility : self . vis . clean ( cx) ,
19982005 stability : cx. stability ( self . id ) . clean ( cx) ,
19992006 deprecation : cx. deprecation ( self . id ) . clean ( cx) ,
2000- inner : TypedefItem (
2001- Typedef { type_ : self . ty . clean ( cx) , generics : self . gen . clean ( cx) } ,
2002- false ,
2003- ) ,
2007+ inner : TypedefItem ( Typedef { type_, generics : self . gen . clean ( cx) , item_type } , false ) ,
20042008 }
20052009 }
20062010}
@@ -2101,7 +2105,7 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
21012105 build_deref_target_impls ( cx, & items, & mut ret) ;
21022106 }
21032107
2104- let provided = trait_
2108+ let provided: FxHashSet < String > = trait_
21052109 . def_id ( )
21062110 . map ( |did| {
21072111 cx. tcx
@@ -2112,7 +2116,12 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
21122116 } )
21132117 . unwrap_or_default ( ) ;
21142118
2115- ret. push ( Item {
2119+ let for_ = self . for_ . clean ( cx) ;
2120+ let type_alias = for_. def_id ( ) . and_then ( |did| match cx. tcx . def_kind ( did) {
2121+ Some ( DefKind :: TyAlias ) => Some ( cx. tcx . type_of ( did) . clean ( cx) ) ,
2122+ _ => None ,
2123+ } ) ;
2124+ let make_item = |trait_ : Option < Type > , for_ : Type , items : Vec < Item > | Item {
21162125 name : None ,
21172126 attrs : self . attrs . clean ( cx) ,
21182127 source : self . whence . clean ( cx) ,
@@ -2123,15 +2132,19 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
21232132 inner : ImplItem ( Impl {
21242133 unsafety : self . unsafety ,
21252134 generics : self . generics . clean ( cx) ,
2126- provided_trait_methods : provided,
2135+ provided_trait_methods : provided. clone ( ) ,
21272136 trait_,
2128- for_ : self . for_ . clean ( cx ) ,
2137+ for_,
21292138 items,
21302139 polarity : Some ( cx. tcx . impl_polarity ( def_id) . clean ( cx) ) ,
21312140 synthetic : false ,
21322141 blanket_impl : None ,
21332142 } ) ,
2134- } ) ;
2143+ } ;
2144+ if let Some ( type_alias) = type_alias {
2145+ ret. push ( make_item ( trait_. clone ( ) , type_alias, items. clone ( ) ) ) ;
2146+ }
2147+ ret. push ( make_item ( trait_, for_, items) ) ;
21352148 ret
21362149 }
21372150}
0 commit comments