Skip to content

Commit

Permalink
Rollup merge of #69583 - LeSeulArtichaut:ice-69378, r=Centril
Browse files Browse the repository at this point in the history
Do not ICE on invalid type node after parse recovery

Closes #69378.
r? @estebank
  • Loading branch information
JohnTitor authored Mar 1, 2020
2 parents 680a0e1 + febf728 commit 9801696
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/librustc_typeck/check/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Regression test for #69378: no type for node after struct parse recovery

struct Foo { 0: u8 } //~ ERROR expected identifier

fn test(f: Foo) {
Foo{foo: 4, ..f};
}

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: expected identifier, found `0`
--> $DIR/issue-69378-ice-on-invalid-type-node-after-recovery.rs:3:14
|
LL | struct Foo { 0: u8 }
| ^ expected identifier

error: aborting due to previous error

0 comments on commit 9801696

Please sign in to comment.