Skip to content

Commit 77a105c

Browse files
committed
Fix ICE #90993: add missing call to cancel
1 parent 3d78974 commit 77a105c

File tree

3 files changed

+38
-1
lines changed

3 files changed

+38
-1
lines changed

compiler/rustc_parse/src/parser/pat.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,7 @@ impl<'a> Parser<'a> {
817817
// Ensure the user doesn't receive unhelpful unexpected token errors
818818
self.bump();
819819
if self.is_pat_range_end_start(0) {
820-
let _ = self.parse_pat_range_end();
820+
let _ = self.parse_pat_range_end().map_err(|mut e| e.cancel());
821821
}
822822

823823
self.error_inclusive_range_with_extra_equals(span_with_eq);

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

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
fn main() {
2+
...=.
3+
//~^ ERROR: unexpected token: `...`
4+
//~| ERROR: unexpected `=` after inclusive range
5+
//~| ERROR: expected one of `-`, `;`, `}`, or path, found `.`
6+
}

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

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
error: unexpected token: `...`
2+
--> $DIR/issue-90993.rs:2:5
3+
|
4+
LL | ...=.
5+
| ^^^
6+
|
7+
help: use `..` for an exclusive range
8+
|
9+
LL | ..=.
10+
| ~~
11+
help: or `..=` for an inclusive range
12+
|
13+
LL | ..==.
14+
| ~~~
15+
16+
error: unexpected `=` after inclusive range
17+
--> $DIR/issue-90993.rs:2:5
18+
|
19+
LL | ...=.
20+
| ^^^^ help: use `..=` instead
21+
|
22+
= note: inclusive ranges end with a single equals sign (`..=`)
23+
24+
error: expected one of `-`, `;`, `}`, or path, found `.`
25+
--> $DIR/issue-90993.rs:2:9
26+
|
27+
LL | ...=.
28+
| ^ expected one of `-`, `;`, `}`, or path
29+
30+
error: aborting due to 3 previous errors
31+

0 commit comments

Comments
 (0)