-
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.
use span of semicolon for eager recovery in expression
instead of the span of the token after the semicolon
- Loading branch information
Lukas Markeffsky
committed
Feb 22, 2023
1 parent
3b4d6e0
commit 611ab68
Showing
3 changed files
with
69 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
6 changes: 6 additions & 0 deletions
6
tests/ui/argument-suggestions/issue-108242-semicolon-recovery.rs
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,6 @@ | ||
fn foo() {} | ||
fn main() { | ||
foo(; //~ ERROR this function takes 0 arguments but 2 arguments were supplied | ||
foo(; //~ ERROR this function takes 0 arguments but 1 argument was supplied | ||
//~^ ERROR expected one of | ||
} //~ ERROR mismatched closing delimiter |
62 changes: 62 additions & 0 deletions
62
tests/ui/argument-suggestions/issue-108242-semicolon-recovery.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,62 @@ | ||
error: expected one of `)`, `,`, `.`, `?`, or an operator, found `foo` | ||
--> $DIR/issue-108242-semicolon-recovery.rs:4:5 | ||
| | ||
LL | foo(; | ||
| - | ||
| | | ||
| expected one of `)`, `,`, `.`, `?`, or an operator | ||
| help: missing `,` | ||
LL | foo(; | ||
| ^^^ unexpected token | ||
|
||
error: mismatched closing delimiter: `}` | ||
--> $DIR/issue-108242-semicolon-recovery.rs:4:8 | ||
| | ||
LL | fn main() { | ||
| - closing delimiter possibly meant for this | ||
LL | foo(; | ||
LL | foo(; | ||
| ^ unclosed delimiter | ||
LL | | ||
LL | } | ||
| ^ mismatched closing delimiter | ||
|
||
error[E0061]: this function takes 0 arguments but 1 argument was supplied | ||
--> $DIR/issue-108242-semicolon-recovery.rs:4:5 | ||
| | ||
LL | foo(; | ||
| ^^^ - | ||
| | | ||
| unexpected argument | ||
| help: remove the extra argument | ||
| | ||
note: function defined here | ||
--> $DIR/issue-108242-semicolon-recovery.rs:1:4 | ||
| | ||
LL | fn foo() {} | ||
| ^^^ | ||
|
||
error[E0061]: this function takes 0 arguments but 2 arguments were supplied | ||
--> $DIR/issue-108242-semicolon-recovery.rs:3:5 | ||
| | ||
LL | foo(; | ||
| ^^^ - unexpected argument | ||
LL | / foo(; | ||
LL | | | ||
LL | | } | ||
| |_- unexpected argument of type `()` | ||
| | ||
note: function defined here | ||
--> $DIR/issue-108242-semicolon-recovery.rs:1:4 | ||
| | ||
LL | fn foo() {} | ||
| ^^^ | ||
help: remove the extra arguments | ||
| | ||
LL - foo(; | ||
LL + foo( | ||
| | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0061`. |