Closed
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
main
function 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
.