-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
parser: don't use
unreachable!()
in fn unexpected
.
- Loading branch information
Showing
3 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// The problem in #66357 was that the call trace: | ||
// | ||
// - parse_fn_block_decl | ||
// - expect_or | ||
// - unexpected | ||
// - expect_one_of | ||
// - expected_one_of_not_found | ||
// - recover_closing_delimiter | ||
// | ||
// ended up bubbling up `Ok(true)` to `unexpected` which then used `unreachable!()`. | ||
|
||
fn f() { |[](* } | ||
//~^ ERROR expected one of `,` or `:`, found `(` | ||
//~| ERROR expected one of `)`, `-`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` |
16 changes: 16 additions & 0 deletions
16
src/test/ui/parser/issue-66357-unexpected-unreachable.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
error: expected one of `,` or `:`, found `(` | ||
--> $DIR/issue-66357-unexpected-unreachable.rs:12:13 | ||
| | ||
LL | fn f() { |[](* } | ||
| ^ expected one of `,` or `:` | ||
|
||
error: expected one of `)`, `-`, `_`, `box`, `mut`, `ref`, `|`, identifier, or path, found `*` | ||
--> $DIR/issue-66357-unexpected-unreachable.rs:12:14 | ||
| | ||
LL | fn f() { |[](* } | ||
| -^ help: `)` may belong here | ||
| | | ||
| unclosed delimiter | ||
|
||
error: aborting due to 2 previous errors | ||
|