forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 1
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#97857 - ChayimFriedman2:box-identifier-help…
…, r=compiler-errors Suggest escaping `box` as identifier Fixes rust-lang#97810.
- Loading branch information
Showing
3 changed files
with
126 additions
and
8 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
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,10 @@ | ||
fn main() { | ||
let box = "foo"; //~ error: expected pattern, found `=` | ||
let box = 0; | ||
//~^ ERROR expected pattern, found `=` | ||
let box: bool; | ||
//~^ ERROR expected pattern, found `:` | ||
let mut box = 0; | ||
//~^ ERROR expected pattern, found `=` | ||
let (box,) = (0,); | ||
//~^ ERROR expected pattern, found `,` | ||
} |
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,8 +1,66 @@ | ||
error: expected pattern, found `=` | ||
--> $DIR/keyword-box-as-identifier.rs:2:13 | ||
| | ||
LL | let box = "foo"; | ||
| ^ expected pattern | ||
LL | let box = 0; | ||
| ^ | ||
| | ||
note: `box` is a reserved keyword | ||
--> $DIR/keyword-box-as-identifier.rs:2:9 | ||
| | ||
LL | let box = 0; | ||
| ^^^ | ||
help: escape `box` to use it as an identifier | ||
| | ||
LL | let r#box = 0; | ||
| ++ | ||
|
||
error: expected pattern, found `:` | ||
--> $DIR/keyword-box-as-identifier.rs:4:12 | ||
| | ||
LL | let box: bool; | ||
| ^ | ||
| | ||
note: `box` is a reserved keyword | ||
--> $DIR/keyword-box-as-identifier.rs:4:9 | ||
| | ||
LL | let box: bool; | ||
| ^^^ | ||
help: escape `box` to use it as an identifier | ||
| | ||
LL | let r#box: bool; | ||
| ++ | ||
|
||
error: expected pattern, found `=` | ||
--> $DIR/keyword-box-as-identifier.rs:6:17 | ||
| | ||
LL | let mut box = 0; | ||
| ^ | ||
| | ||
note: `box` is a reserved keyword | ||
--> $DIR/keyword-box-as-identifier.rs:6:13 | ||
| | ||
LL | let mut box = 0; | ||
| ^^^ | ||
help: escape `box` to use it as an identifier | ||
| | ||
LL | let mut r#box = 0; | ||
| ++ | ||
|
||
error: expected pattern, found `,` | ||
--> $DIR/keyword-box-as-identifier.rs:8:13 | ||
| | ||
LL | let (box,) = (0,); | ||
| ^ | ||
| | ||
note: `box` is a reserved keyword | ||
--> $DIR/keyword-box-as-identifier.rs:8:10 | ||
| | ||
LL | let (box,) = (0,); | ||
| ^^^ | ||
help: escape `box` to use it as an identifier | ||
| | ||
LL | let (r#box,) = (0,); | ||
| ++ | ||
|
||
error: aborting due to previous error | ||
error: aborting due to 4 previous errors | ||
|