Skip to content

Commit ca476ab

Browse files
committed
Auto merge of #9233 - alexcrichton:reword-edition, r=ehuss
Wordsmith the edition documentation a bit more This hopes to clear up a few recent PRs about the `edition` key in the manifest. It shuffles things around so the defaults are talked about in two different paragraphs. The first one talks about how `cargo new` uses the 2018 edition and is the only paragraph to use the word "default". The second section talks about the usage of 2015 with no `edition` field present. This didn't end up being quite as clear as I hoped it might be, but I'm hoping that this provides a bit more emphasis or otherwise just restructures things a bit to be more clear.
2 parents 0f3f47e + ce00667 commit ca476ab

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/doc/src/reference/manifest.md

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,18 +120,24 @@ brackets at the end of each author.
120120
#### The `edition` field
121121

122122
The `edition` key is an optional key that affects which [Rust Edition] your package
123-
is compiled with. [`cargo new`] will generate a package with the `edition` key
124-
set to the latest edition. Setting the `edition` key in
125-
`[package]` will affect all targets/crates in the package, including test
126-
suites, benchmarks, binaries, examples, etc.
123+
is compiled with. Setting the `edition` key in `[package]` will affect all
124+
targets/crates in the package, including test suites, benchmarks, binaries,
125+
examples, etc.
127126

128127
```toml
129128
[package]
130129
# ...
131130
edition = '2018'
132131
```
133132

134-
If the `edition` key is not set in your `Cargo.toml`, Cargo will default to 2015.
133+
Most manifests have the `edition` field filled in automatically by [`cargo new`]
134+
with the latest stable edition. By default `cargo new` creates a manifest with
135+
the 2018 edition currently.
136+
137+
If the `edition` field is not present in `Cargo.toml`, then the 2015 edition is
138+
assumed for backwards compatibility. Note that all manifests
139+
created with [`cargo new`] will not use this historical fallback because they
140+
will have `edition` explicitly specified to a newer value.
135141

136142
#### The `description` field
137143

0 commit comments

Comments
 (0)