-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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 #104309 - chenyukang:yukang/fix-104088-identifier-err…
…or, r=davidtwco Slightly improve error message for invalid identifier fixes #104088
- Loading branch information
Showing
7 changed files
with
80 additions
and
2 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
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,26 @@ | ||
fn test() { | ||
if let 123 = 123 { println!("yes"); } | ||
} | ||
|
||
fn test_2() { | ||
let 1x = 123; | ||
//~^ ERROR expected identifier, found number literal | ||
} | ||
|
||
fn test_3() { | ||
let 2x: i32 = 123; | ||
//~^ ERROR expected identifier, found number literal | ||
} | ||
|
||
fn test_4() { | ||
if let 2e1 = 123 { | ||
//~^ ERROR mismatched types | ||
} | ||
} | ||
|
||
fn test_5() { | ||
let 23name = 123; | ||
//~^ ERROR expected identifier, found number literal | ||
} | ||
|
||
fn main() {} |
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,29 @@ | ||
error: expected identifier, found number literal | ||
--> $DIR/issue-104088.rs:6:9 | ||
| | ||
LL | let 1x = 123; | ||
| ^^ identifiers cannot start with a number | ||
|
||
error: expected identifier, found number literal | ||
--> $DIR/issue-104088.rs:11:9 | ||
| | ||
LL | let 2x: i32 = 123; | ||
| ^^ identifiers cannot start with a number | ||
|
||
error: expected identifier, found number literal | ||
--> $DIR/issue-104088.rs:22:9 | ||
| | ||
LL | let 23name = 123; | ||
| ^^^^^^ identifiers cannot start with a number | ||
|
||
error[E0308]: mismatched types | ||
--> $DIR/issue-104088.rs:16:12 | ||
| | ||
LL | if let 2e1 = 123 { | ||
| ^^^ --- this expression has type `{integer}` | ||
| | | ||
| expected integer, found floating-point number | ||
|
||
error: aborting due to 4 previous errors | ||
|
||
For more information about this error, try `rustc --explain E0308`. |
File renamed without changes.
File renamed without changes.