Closed LoganDark closed 2 years ago
The cargo
block must be a section of a complete manifest. edition
is a subkey of package
, not a top-level key, so you need
//! ```cargo
//! [package]
//! edition = '2021'
//! ```
e.g.
//! ```cargo
//! [package]
//! edition = '2021'
//! ```
fn main() {
let mut a = (1, 2);
let mut f = || {
a.0 += 1;
a.0
};
println!("{} {}", a.1, f())
}
works fine, and absolutely can not compile without edition 2021 (because it uses disjoint closure capture).
Huh, thanks!
rust-script is trying to execute my file as 2018 edition which is wrong. I can't find any documentation on getting it to use 2021 edition and this does not work: