forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of rust-lang#125276 - dev-ardi:no-main-diag, r=fmease Fix parsing of erroneously placed semicolons This closes rust-lang#124935, is a continuation of rust-lang#125245 after rebasing rust-lang#125117. Thanks ```@gurry``` for your code and sorry for making it confusing :P r? fmease
- Loading branch information
Showing
7 changed files
with
42 additions
and
7 deletions.
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/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.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 @@ | ||
// Regression test for issue #124935 | ||
// Tests that we do not erroneously emit an error about | ||
// missing main function when the mod starts with a `;` | ||
|
||
; //~ ERROR expected item, found `;` | ||
fn main() { } |
8 changes: 8 additions & 0 deletions
8
tests/ui/parser/issues/fn-no-semicolon-issue-124935-semi-after-item.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,8 @@ | ||
error: expected item, found `;` | ||
--> $DIR/fn-no-semicolon-issue-124935-semi-after-item.rs:5:1 | ||
| | ||
LL | ; | ||
| ^ help: remove this semicolon | ||
|
||
error: aborting due to 1 previous error | ||
|
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#![allow(unused_variables)]; //~ ERROR expected item, found `;` | ||
//~^ ERROR `main` function | ||
fn foo() {} | ||
//~^ ERROR `main` function |
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
5 changes: 5 additions & 0 deletions
5
tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.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,5 @@ | ||
// Regression test for issue #124935 | ||
// Tests that we still emit an error after an item. | ||
|
||
fn main() { } | ||
; //~ ERROR expected item, found `;` |
10 changes: 10 additions & 0 deletions
10
tests/ui/parser/issues/missing-main-issue-124935-semi-after-item.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,10 @@ | ||
error: expected item, found `;` | ||
--> $DIR/missing-main-issue-124935-semi-after-item.rs:5:1 | ||
| | ||
LL | ; | ||
| ^ help: remove this semicolon | ||
| | ||
= help: function declarations are not followed by a semicolon | ||
|
||
error: aborting due to 1 previous error | ||
|