Skip to content

Commit d274fcf

Browse files
committed
Auto merge of #8953 - hkennyv:clarify-package-edition-docs, r=Eh2406
Clarify cargo manifest edition field docs addresses #8951 This PR aims to clarify the documentation for the `edition` field in the Cargo manifest. The confusion (IME) stems from the behavior of `cargo new` (defaults to writing edition = "2018") being confused for the default behavior of how Cargo interprets the manifest (`edition` is an optional key, defaults to 2015). would love to get some other thoughts on how we can clarify this since it seems like I'm not the only one who got confused `@Eh2406`
2 parents 8ff53f6 + da5b079 commit d274fcf

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/doc/src/reference/manifest.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,22 +118,21 @@ brackets at the end of each author.
118118
<a id="the-edition-field-optional"></a>
119119
#### The `edition` field
120120

121-
You can opt in to a specific [Rust Edition] for your package with the
122-
`edition` key in `Cargo.toml`. If you don't specify the edition, it will
123-
default to 2015.
121+
The `edition` key is an optional key that affects which edition your package
122+
is compiled with. [`cargo new`] will generate a package with the `edition` key
123+
set to the latest edition. Setting the `edition` key in
124+
`[package]` will affect all targets/crates in the package, including test
125+
suites, benchmarks, binaries, examples, etc.
126+
127+
If the `edition` key is not set to a specific [Rust Edition] in your
128+
`Cargo.toml`, Cargo will default to 2015.
124129

125130
```toml
126131
[package]
127132
# ...
128133
edition = '2018'
129134
```
130135

131-
The `edition` key affects which edition your package is compiled with. Cargo
132-
will always generate packages via [`cargo new`] with the `edition` key set to the
133-
latest edition. Setting the `edition` key in `[package]` will affect all
134-
targets/crates in the package, including test suites, benchmarks, binaries,
135-
examples, etc.
136-
137136
#### The `description` field
138137

139138
The description is a short blurb about the package. [crates.io] will display

0 commit comments

Comments
 (0)