Repository navigation
internal compiler error: no type for node HirId ... #69378
Description
Activity
- addedA-type-systemArea: Type systemArea: Type systemC-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
on Feb 22, 2020 I'm looking into this! But mostly as a learning exercise. Spent ~4 hours exploring typeck & error handling today to see why this exact combination of things triggers an error. My friend and I will probably have a solution at some point, but it might be a few weeks from now.
If anyone has a good & quick solution, or if it is deemed high-priority, then feel free to ignore me.
According tocargo-bisect-rustc, this regressed between 2019-07-30 and 2019-07-31. Unfortunately,cargo-bisect-rustcseems to be incapable of narrowing it down to a commit because that was more than 167 days ago.EDIT:
cargo-bisect-rustcgave me a misleading result. This error is at least as old asnightly-2019-07-19.The ICE goes away if I apply this patch:
$ git diff diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 38d73256469..a3bb0c2fb81 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -1311,9 +1311,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { kind_name: &str, ty_span: Span, ) { - if variant.recovered { - return; - } let mut err = self.type_error_struct_with_diag( field.ident.span, |actual| match ty.kind {(Though I'd guess that making this change would cause us to regress on the problems that #59266 fixed.)
This change fixes the ICE and avoids regressing on
ui/parser/recovered-struct-variant.rs:$ git diff diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 38d73256469..bd80cc31e3c 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -1218,8 +1218,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { self.field_ty(field.span, v_field, substs) } else { - error_happened = true; if let Some(prev_span) = seen_fields.get(&ident) { + error_happened = true; let mut err = struct_span_err!( self.tcx.sess, field.ident.span, @@ -1232,7 +1232,8 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { err.span_label(*prev_span, format!("first use of `{}`", ident)); err.emit(); - } else { + } else if !variant.recovered { + error_happened = true; self.report_unknown_field(adt_ty, variant, field, ast_fields, kind_name, span); } @@ -1311,9 +1312,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { kind_name: &str, ty_span: Span, ) { - if variant.recovered { - return; - } let mut err = self.type_error_struct_with_diag( field.ident.span, |actual| match ty.kind {I'm unsure whether this respects the intended meaning of
error_happened, though.Reacted by Esteban Kuber@dwrensha on a very cursory look that patch looks reasonable.
#50643 has some additional relevant context.
Unfortunately, the patch that I proposed above fails on this modification of
ui/issues/issue-50618.rs:struct Point { pub x: u64, pub y: u64, 0: u64, } fn main() { let _ = |t: Point| { Point { nonexistent: 0, ..t } }; }
- addedP-highHigh priorityHigh priorityregression-from-stable-to-stablePerformance or correctness regression from one stable version to another.Performance or correctness regression from one stable version to another.and removed
on Feb 27, 2020 triage: P-high. Removing nomination. Added regression stable-to-stable tag.
- addedglacierICE tracked in rust-lang/glacier.ICE tracked in rust-lang/glacier.
on Feb 28, 2020 I think I found a way to resolve this without regressing on #59266. The point of this PR is to not emit an error if it might be invalid to the user. But there are errors in context still. The patch I propose is this:
diff --git a/src/librustc_typeck/check/expr.rs b/src/librustc_typeck/check/expr.rs index 38d73256469..14615521749 100644 --- a/src/librustc_typeck/check/expr.rs +++ b/src/librustc_typeck/check/expr.rs @@ -1312,6 +1312,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { ty_span: Span, ) { if variant.recovered { + self.set_tainted_by_errors(); return; } let mut err = self.type_error_struct_with_diag(This does pass every UI test. I'll open a PR so this can be discussed more easely.
- added a commit that references this issue
on Mar 1, 2020
I'm seeing an internal compiler error on the following input (found by fuzz-rustc):
The error happens on
stable,beta, andnightly.