]> git.lizzy.rs Git - rust.git/commitdiff
Fix rustdoc
authorOliver Schneider <github35764891676564198441@oli-obk.de>
Tue, 2 Oct 2018 10:31:05 +0000 (12:31 +0200)
committerOliver Schneider <github35764891676564198441@oli-obk.de>
Tue, 2 Oct 2018 10:31:05 +0000 (12:31 +0200)
src/librustdoc/clean/mod.rs

index a91f2fd7474f5b7b28e1136bcd9c0521d404d83a..b32e76a6f2e382c77dea8684f7990736149d4719 100644 (file)
@@ -2416,6 +2416,14 @@ fn clean(&self, cx: &DocContext) -> Type {
                 Array(box ty.clean(cx), length)
             },
             TyKind::Tup(ref tys) => Tuple(tys.clean(cx)),
+            TyKind::Def(item_id, _) => {
+                let item = cx.tcx.hir.expect_item(item_id.id);
+                if let hir::ItemKind::Existential(ref ty) = item.node {
+                    ImplTrait(ty.bounds.clean(cx))
+                } else {
+                    unreachable!()
+                }
+            }
             TyKind::Path(hir::QPath::Resolved(None, ref path)) => {
                 if let Some(new_ty) = cx.ty_substs.borrow().get(&path.def).cloned() {
                     return new_ty;
@@ -2425,14 +2433,6 @@ fn clean(&self, cx: &DocContext) -> Type {
                     if let Some(bounds) = cx.impl_trait_bounds.borrow_mut().remove(&did) {
                         return ImplTrait(bounds);
                     }
-                } else if let Def::Existential(did) = path.def {
-                    // This block is for returned impl trait only.
-                    if let Some(node_id) = cx.tcx.hir.as_local_node_id(did) {
-                        let item = cx.tcx.hir.expect_item(node_id);
-                        if let hir::ItemKind::Existential(ref ty) = item.node {
-                            return ImplTrait(ty.bounds.clean(cx));
-                        }
-                    }
                 }
 
                 let mut alias = None;