Compile Error with rustc but no with IntelliJ IDEA

I am programming in rust on IntelliJ IDEA, when i run on IntelliJ IDEA i can compile whit out Problems , but when i run rustc main.rs i got this error :

rustc main.rs
error: expected one of !, ), ,, ., ::, ?, {, or an operator, found keyword move
--> main.rs:20:41
|
20 | async_std::task::block_on(async move {
| ^^^^ expected one of 8 possible tokens
error: aborting due to previous error

I don't understand what change?

You would have to post the code in question. Please post the code in a code block, not a quote block like you did with the error.

You have to pass --edition 2018 to rustc to use the async keyword.

When you (or your IDE) build with Cargo, it passes this automatically based on the edition field in the Cargo.toml file.

4 Likes