Problem
The current documentation specifies that the default value for the edition is 2015. I believe it should be 2018 (after doing a quick search for "rust edition" in this repository).
Steps
Possible Solution(s)
Update the docs to reflect the new default value, 2018
(i have a PR on the way!)
Notes
Output of cargo version:
cargo 1.50.0-nightly (bfca1cd22 2020-11-24)
If you don't have an addition specified in your Cargo.toml then we use edition 2015. @ehuss pointed it out to me the last time I tried to "fix" this documentation. It is clearly confusing, as we keep getting PRs to change it. Is there a clearer way to explain what is ment?
@Eh2406 Glad to hear I'm not the only person who got confused when reading this. After reading @ehuss 's comment and re-reading the section, it makes sense.
I think the confusing part is that it is an optional key but running cargo new automatically writes it. For someone whose not well-versed in Cargo, you wouldn't think it's optional.
I reworded the edition section below. That makes sense to me, anyone else have any thoughts?
edition fieldThe edition key is an optional key that affects which edition your package is compiled with. Cargo
will always generate packages via [cargo new] with the edition key set to the
latest edition. Setting the edition key in [package] will affect all
targets/crates in the package, including test suites, benchmarks, binaries,
examples, etc.
If the edition key is not set to a specific [Rust Edition] in your Cargo.toml, Cargo will
default to 2015.
[package]
# ...
edition = '2018'
Sounds reasonable. Want to make a PR with that clarification and we can wordsmith there?
done, let's discuss here #8953
Most helpful comment
Sounds reasonable. Want to make a PR with that clarification and we can wordsmith there?