about summary refs log tree commit diff
path: root/compiler
diff options
context:
space:
mode:
authorYuki Okushi <yuki.okushi@huawei.com>2021-06-21 14:53:50 +0900
committerYuki Okushi <yuki.okushi@huawei.com>2021-06-24 14:06:28 +0900
commita141d2961289774f15ed884a52cd03c7d096aac5 (patch)
treea4e8b47be1a385c05557610d3f0718f87342a925 /compiler
parentf1e691da2e640bb45fe18f8a5bd8f7afa65ce21d (diff)
downloadrust-a141d2961289774f15ed884a52cd03c7d096aac5.tar.gz
rust-a141d2961289774f15ed884a52cd03c7d096aac5.zip
Do not panic in `return_type_impl_trait`
Diffstat (limited to 'compiler')
-rw-r--r--compiler/rustc_middle/src/ty/context.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index a74070100f4..bf5176f6585 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -44,6 +44,7 @@ use rustc_hir::intravisit::Visitor;
 use rustc_hir::lang_items::LangItem;
 use rustc_hir::{
     Constness, HirId, ItemKind, ItemLocalId, ItemLocalMap, ItemLocalSet, Node, TraitCandidate,
+    TraitItemKind,
 };
 use rustc_index::vec::{Idx, IndexVec};
 use rustc_macros::HashStable;
@@ -1509,6 +1510,12 @@ impl<'tcx> TyCtxt<'tcx> {
                     }
                 }
             }
+            Node::TraitItem(item) => {
+                // #86483: Return early if it doesn't have a concrete type.
+                if let TraitItemKind::Type(_, None) = item.kind {
+                    return None;
+                }
+            }
             _ => { /* `type_of_def_id()` will work or panic */ }
         }