Skip to content

Commit 9801696

Browse files
authored
Rollup merge of #69583 - LeSeulArtichaut:ice-69378, r=Centril
Do not ICE on invalid type node after parse recovery Closes #69378. r? @estebank
2 parents 680a0e1 + febf728 commit 9801696

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

src/librustc_typeck/check/expr.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1312,6 +1312,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13121312
ty_span: Span,
13131313
) {
13141314
if variant.recovered {
1315+
self.set_tainted_by_errors();
13151316
return;
13161317
}
13171318
let mut err = self.type_error_struct_with_diag(
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Regression test for #69378: no type for node after struct parse recovery
2+
3+
struct Foo { 0: u8 } //~ ERROR expected identifier
4+
5+
fn test(f: Foo) {
6+
Foo{foo: 4, ..f};
7+
}
8+
9+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: expected identifier, found `0`
2+
--> $DIR/issue-69378-ice-on-invalid-type-node-after-recovery.rs:3:14
3+
|
4+
LL | struct Foo { 0: u8 }
5+
| ^ expected identifier
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)