Rollup merge of #69583 - LeSeulArtichaut:ice-69378, r=Centril

Do not ICE on invalid type node after parse recovery

Closes #69378.
r? @estebank
This commit is contained in:
Yuki Okushi 2020-03-01 19:28:13 +09:00 committed by GitHub
commit 9801696214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View File

@ -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(

View File

@ -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() {}

View File

@ -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