Skip to content

Commit b3321fb

Browse files
committed
Fix ICE in #63135
1 parent f690098 commit b3321fb

File tree

3 files changed

+56
-1
lines changed

3 files changed

+56
-1
lines changed

src/libsyntax/parse/parser.rs

+9-1
Original file line numberDiff line numberDiff line change
@@ -3620,7 +3620,15 @@ impl<'a> Parser<'a> {
36203620
let mut etc_span = None;
36213621

36223622
while self.token != token::CloseDelim(token::Brace) {
3623-
let attrs = self.parse_outer_attributes()?;
3623+
let attrs = match self.parse_outer_attributes() {
3624+
Ok(attrs) => attrs,
3625+
Err(err) => {
3626+
if let Some(mut delayed) = delayed_err {
3627+
delayed.emit();
3628+
}
3629+
return Err(err);
3630+
},
3631+
};
36243632
let lo = self.token.span;
36253633

36263634
// check that a comma comes after every field

src/test/ui/parser/issue-63135.rs

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// error-pattern: aborting due to 6 previous errors
2+
3+
fn i(n{...,f #

src/test/ui/parser/issue-63135.stderr

+44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
error: this file contains an un-closed delimiter
2+
--> $DIR/issue-63135.rs:3:16
3+
|
4+
LL | fn i(n{...,f #
5+
| - - ^
6+
| | |
7+
| | un-closed delimiter
8+
| un-closed delimiter
9+
10+
error: expected field pattern, found `...`
11+
--> $DIR/issue-63135.rs:3:8
12+
|
13+
LL | fn i(n{...,f #
14+
| ^^^ help: to omit remaining fields, use one fewer `.`: `..`
15+
16+
error: expected `}`, found `,`
17+
--> $DIR/issue-63135.rs:3:11
18+
|
19+
LL | fn i(n{...,f #
20+
| ---^
21+
| | |
22+
| | expected `}`
23+
| `..` must be at the end and cannot have a trailing comma
24+
25+
error: expected `[`, found `}`
26+
--> $DIR/issue-63135.rs:3:15
27+
|
28+
LL | fn i(n{...,f #
29+
| ^ expected `[`
30+
31+
error: expected `:`, found `)`
32+
--> $DIR/issue-63135.rs:3:15
33+
|
34+
LL | fn i(n{...,f #
35+
| ^ expected `:`
36+
37+
error: expected one of `->`, `where`, or `{`, found `<eof>`
38+
--> $DIR/issue-63135.rs:3:15
39+
|
40+
LL | fn i(n{...,f #
41+
| ^ expected one of `->`, `where`, or `{` here
42+
43+
error: aborting due to 6 previous errors
44+

0 commit comments

Comments
 (0)