diff options
| author | Yuki Okushi <yuki.okushi@huawei.com> | 2021-06-21 14:53:50 +0900 |
|---|---|---|
| committer | Yuki Okushi <yuki.okushi@huawei.com> | 2021-06-24 14:06:28 +0900 |
| commit | a141d2961289774f15ed884a52cd03c7d096aac5 (patch) | |
| tree | a4e8b47be1a385c05557610d3f0718f87342a925 /compiler | |
| parent | f1e691da2e640bb45fe18f8a5bd8f7afa65ce21d (diff) | |
| download | rust-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.rs | 7 |
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 */ } } |
