File tree Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Expand file tree Collapse file tree 1 file changed +8
-8
lines changed Original file line number Diff line number Diff line change @@ -2416,6 +2416,14 @@ impl Clean<Type> for hir::Ty {
2416
2416
Array ( box ty. clean ( cx) , length)
2417
2417
} ,
2418
2418
TyKind :: Tup ( ref tys) => Tuple ( tys. clean ( cx) ) ,
2419
+ TyKind :: Def ( item_id, _) => {
2420
+ let item = cx. tcx . hir . expect_item ( item_id. id ) ;
2421
+ if let hir:: ItemKind :: Existential ( ref ty) = item. node {
2422
+ ImplTrait ( ty. bounds . clean ( cx) )
2423
+ } else {
2424
+ unreachable ! ( )
2425
+ }
2426
+ }
2419
2427
TyKind :: Path ( hir:: QPath :: Resolved ( None , ref path) ) => {
2420
2428
if let Some ( new_ty) = cx. ty_substs . borrow ( ) . get ( & path. def ) . cloned ( ) {
2421
2429
return new_ty;
@@ -2425,14 +2433,6 @@ impl Clean<Type> for hir::Ty {
2425
2433
if let Some ( bounds) = cx. impl_trait_bounds . borrow_mut ( ) . remove ( & did) {
2426
2434
return ImplTrait ( bounds) ;
2427
2435
}
2428
- } else if let Def :: Existential ( did) = path. def {
2429
- // This block is for returned impl trait only.
2430
- if let Some ( node_id) = cx. tcx . hir . as_local_node_id ( did) {
2431
- let item = cx. tcx . hir . expect_item ( node_id) ;
2432
- if let hir:: ItemKind :: Existential ( ref ty) = item. node {
2433
- return ImplTrait ( ty. bounds . clean ( cx) ) ;
2434
- }
2435
- }
2436
2436
}
2437
2437
2438
2438
let mut alias = None ;
You can’t perform that action at this time.
0 commit comments