-
Notifications
You must be signed in to change notification settings - Fork 13.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
suggest a missing semicolon before an array
- Loading branch information
Showing
6 changed files
with
95 additions
and
0 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
8 changes: 8 additions & 0 deletions
8
src/test/ui/parser/do-not-suggest-suggest-semicolon-before-array.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,8 @@ | ||
fn foo() {} | ||
|
||
fn bar() -> [u8; 2] { | ||
foo() | ||
[1, 3) //~ ERROR expected one of `.`, `?`, `]`, or an operator, found `,` | ||
} | ||
|
||
fn main() {} |
10 changes: 10 additions & 0 deletions
10
src/test/ui/parser/do-not-suggest-suggest-semicolon-before-array.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 one of `.`, `?`, `]`, or an operator, found `,` | ||
--> $DIR/do-not-suggest-suggest-semicolon-before-array.rs:5:5 | ||
| | ||
LL | [1, 3) | ||
| ^ ^ help: `]` may belong here | ||
| | | ||
| unclosed delimiter | ||
|
||
error: aborting due to previous error | ||
|
11 changes: 11 additions & 0 deletions
11
src/test/ui/parser/suggest-suggest-semicolon-before-array.fixed
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,11 @@ | ||
// run-rustfix | ||
#![allow(dead_code)] | ||
|
||
fn foo() {} | ||
|
||
fn bar() -> [u8; 2] { | ||
foo(); | ||
[1, 3] //~ ERROR expected `;`, found `[` | ||
} | ||
|
||
fn main() {} |
11 changes: 11 additions & 0 deletions
11
src/test/ui/parser/suggest-suggest-semicolon-before-array.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,11 @@ | ||
// run-rustfix | ||
#![allow(dead_code)] | ||
|
||
fn foo() {} | ||
|
||
fn bar() -> [u8; 2] { | ||
foo() | ||
[1, 3] //~ ERROR expected `;`, found `[` | ||
} | ||
|
||
fn main() {} |
13 changes: 13 additions & 0 deletions
13
src/test/ui/parser/suggest-suggest-semicolon-before-array.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,13 @@ | ||
error: expected `;`, found `[` | ||
--> $DIR/suggest-suggest-semicolon-before-array.rs:8:5 | ||
| | ||
LL | [1, 3] | ||
| ^ | ||
| | ||
help: consider adding `;` here | ||
| | ||
LL | foo(); | ||
| + | ||
|
||
error: aborting due to previous error | ||
|