]> git.lizzy.rs Git - rust.git/blob - compiler/rustc_error_codes/src/error_codes/E0580.md
Rollup merge of #93556 - dtolnay:trailingcomma, r=cjgillot
[rust.git] / compiler / rustc_error_codes / src / error_codes / E0580.md
1 The `main` function was incorrectly declared.
2
3 Erroneous code example:
4
5 ```compile_fail,E0580
6 fn main(x: i32) { // error: main function has wrong type
7     println!("{}", x);
8 }
9 ```
10
11 The `main` function prototype should never take arguments.
12 Example:
13
14 ```
15 fn main() {
16     // your code
17 }
18 ```
19
20 If you want to get command-line arguments, use `std::env::args`. To exit with a
21 specified exit code, use `std::process::exit`.