-
Notifications
You must be signed in to change notification settings - Fork 14k
Closed
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
fn main(hmm: &i32) {
println!("Hello, world!");
}Current output
error[E0131]: `main` function is not allowed to have generic parameters
--> src\bin\8.rs:22:8
|
22 | fn main(hmm: &i32) {
| ^ `main` cannot have generic parameters
For more information about this error, try `rustc --explain E0131`.Desired output
error[E0580]: `main` function has wrong type
--> src\bin\8.rs:22:1
|
22 | fn main(hmm: i32) {
| ^^^^^^^^^^^^^^^^^ incorrect number of function parameters
|
= note: expected signature `fn()`
found signature `fn(i32)`
For more information about this error, try `rustc --explain E0580`.Rationale and extra context
It is less clear to display the E0131 message for the situation, because it it's about generic parameters. Eg to quote from rustc --explain E0131:
fn main() { // error: main function is not allowed to have generic parameters
Whereas rustc --explain E0580 explains:
The
mainfunction prototype should never take arguments.
Other cases
No response
Anything else?
Additionally, neither error is output when the command run is cargo test; which is probably erroneous behavior, as check, clippy, build, and run.
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsD-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.