Rust errors / Everything else
Rust compiler error · checked with rustc 1.99.0
Rust error E0646: `main` function is not allowed to have a `where` clause
What it meansIt is not possible to define main with a where clause.
What rustc prints
error[E0646]: `main` function is not allowed to have a `where` clause
--> main.rs:1:11
|
1 | fn main() where i32: Copy { // error: main function is not allowed to have
| ^^^^^^^^^^^^^^^ `main` cannot have a `where` clauseReal output of rustc 1.99.0 compiling the official example below (2021 edition). Your names and line numbers will differ; the first line is the part to match.
The compiler team's explanation
It is not possible to define main with a where clause.
Erroneous code example:
fn main() where i32: Copy { // error: main function is not allowed to have
// a where clause
}From rustc --explain E0646 (1.99.0), part of the Rust project, MIT or Apache-2.0. Official page.
Related errors
- E0061this function takes N arguments but M were supplied
- E0412cannot find type in this scope
- E0515cannot return reference to local variable
- E0728await is only allowed inside async functions and blocks
- E0628too many parameters for a coroutine (expected 0 or 1 parameters)
- E0641cannot cast to a pointer of an unknown kind
- E0659`foo` is ambiguous
- E0670Rust 2015 does not permit the use of `async fn`
Up next
Often hit nextE0061: this function takes N arguments but M were suppliedA related error from the same family.Read it next →Did this answer your question?