@@ -1122,7 +1122,9 @@ impl Clean<Item> for hir::ImplItem<'_> {
1122
1122
MethodItem ( ( sig, & self . generics , body, Some ( self . defaultness ) ) . clean ( cx) )
1123
1123
}
1124
1124
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 )
1126
1128
}
1127
1129
hir:: ImplItemKind :: OpaqueTy ( ref bounds) => OpaqueTyItem (
1128
1130
OpaqueTy { bounds : bounds. clean ( cx) , generics : Generics :: default ( ) } ,
@@ -1282,10 +1284,13 @@ impl Clean<Item> for ty::AssocItem {
1282
1284
1283
1285
AssocTypeItem ( bounds, ty. clean ( cx) )
1284
1286
} 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) ) ;
1285
1289
TypedefItem (
1286
1290
Typedef {
1287
- type_ : cx . tcx . type_of ( self . def_id ) . clean ( cx ) ,
1291
+ type_,
1288
1292
generics : Generics { params : Vec :: new ( ) , where_predicates : Vec :: new ( ) } ,
1293
+ item_type,
1289
1294
} ,
1290
1295
true ,
1291
1296
)
@@ -1989,6 +1994,8 @@ impl Clean<String> for ast::Name {
1989
1994
1990
1995
impl Clean < Item > for doctree:: Typedef < ' _ > {
1991
1996
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) ) ;
1992
1999
Item {
1993
2000
name : Some ( self . name . clean ( cx) ) ,
1994
2001
attrs : self . attrs . clean ( cx) ,
@@ -1997,10 +2004,7 @@ impl Clean<Item> for doctree::Typedef<'_> {
1997
2004
visibility : self . vis . clean ( cx) ,
1998
2005
stability : cx. stability ( self . id ) . clean ( cx) ,
1999
2006
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 ) ,
2004
2008
}
2005
2009
}
2006
2010
}
@@ -2101,7 +2105,7 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
2101
2105
build_deref_target_impls ( cx, & items, & mut ret) ;
2102
2106
}
2103
2107
2104
- let provided = trait_
2108
+ let provided: FxHashSet < String > = trait_
2105
2109
. def_id ( )
2106
2110
. map ( |did| {
2107
2111
cx. tcx
@@ -2112,7 +2116,12 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
2112
2116
} )
2113
2117
. unwrap_or_default ( ) ;
2114
2118
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 {
2116
2125
name : None ,
2117
2126
attrs : self . attrs . clean ( cx) ,
2118
2127
source : self . whence . clean ( cx) ,
@@ -2123,15 +2132,19 @@ impl Clean<Vec<Item>> for doctree::Impl<'_> {
2123
2132
inner : ImplItem ( Impl {
2124
2133
unsafety : self . unsafety ,
2125
2134
generics : self . generics . clean ( cx) ,
2126
- provided_trait_methods : provided,
2135
+ provided_trait_methods : provided. clone ( ) ,
2127
2136
trait_,
2128
- for_ : self . for_ . clean ( cx ) ,
2137
+ for_,
2129
2138
items,
2130
2139
polarity : Some ( cx. tcx . impl_polarity ( def_id) . clean ( cx) ) ,
2131
2140
synthetic : false ,
2132
2141
blanket_impl : None ,
2133
2142
} ) ,
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) ) ;
2135
2148
ret
2136
2149
}
2137
2150
}
0 commit comments