Skip to content

Commit 741f0e5

Browse files
committed
Auto merge of #7733 - ehuss:doc-updates, r=Eh2406
Various doc updates This is a collection of documentation updates that have been in my todo list for a while. Each change is in a separate commit. The "features" chapter will probably get significant changes in the future, as it is pretty bare right now. Similarly the "workspace" chapter could probably use more examples. Closes #3062 Closes #3817 Closes #3971 Closes #4212 Closes #4438 Closes #4756 Closes #5822 Closes #6913 Closes #7055
2 parents 7c2cadd + 493eb34 commit 741f0e5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1813
-1084
lines changed

src/doc/man/cargo-fix.adoc

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,18 @@ executing:
2828

2929
cargo fix --edition
3030

31-
which behaves the same as `cargo check --all-targets`. Similarly if you'd like
32-
to fix code for different platforms you can do:
31+
which behaves the same as `cargo check --all-targets`.
3332

34-
cargo fix --edition --target x86_64-pc-windows-gnu
33+
`cargo fix` is only capable of fixing code that is normally compiled with
34+
`cargo check`. If code is conditionally enabled with optional features, you
35+
will need to enable those features for that code to be analyzed:
36+
37+
cargo fix --edition --features foo
3538

36-
or if your crate has optional features:
39+
Similarly, other `cfg` expressions like platform-specific code will need to
40+
pass `--target` to fix code for the given target.
3741

38-
cargo fix --edition --no-default-features --features foo
42+
cargo fix --edition --target x86_64-pc-windows-gnu
3943

4044
If you encounter any problems with `cargo fix` or otherwise have any questions
4145
or feature requests please don't hesitate to file an issue at

src/doc/man/cargo-package.adoc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ steps:
3333
about the current VCS checkout hash if available (not included with
3434
`--allow-dirty`).
3535
. Extract the `.crate` file and build it to verify it can build.
36+
- This will rebuild your package from scratch to ensure that it can be
37+
built from a pristine state. The `--no-verify` flag can be used to skip
38+
this step.
3639
. Check that build scripts did not modify any source files.
3740

3841
The list of files included can be controlled with the `include` and `exclude`

src/doc/man/cargo-rustc.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ flags.
2525

2626
include::description-one-target.adoc[]
2727
To pass flags to all compiler processes spawned by Cargo, use the `RUSTFLAGS`
28-
environment variable or the `build.rustflags`
29-
linkcargo:reference/config.html[config value].
28+
linkcargo:reference/environment-variables.html[environment variable] or the
29+
`build.rustflags` linkcargo:reference/config.html[config value].
3030

3131
== OPTIONS
3232

src/doc/man/cargo-rustdoc.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ flags.
2525

2626
include::description-one-target.adoc[]
2727
To pass flags to all rustdoc processes spawned by Cargo, use the
28-
`RUSTDOCFLAGS` environment variable or the `build.rustdocflags` configuration
29-
option.
28+
`RUSTDOCFLAGS` linkcargo:reference/environment-variables.html[environment variable]
29+
or the `build.rustdocflags` linkcargo:reference/config.html[config value].
3030

3131
== OPTIONS
3232

src/doc/man/generated/cargo-bench.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,8 @@ <h3 id="cargo_bench_feature_selection">Feature Selection</h3>
213213
<dd>
214214
<p>Space or comma separated list of features to activate. These features only
215215
apply to the current directory&#8217;s package. Features of direct dependencies
216-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
216+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
217+
specified multiple times, which enables all specified features.</p>
217218
</dd>
218219
<dt class="hdlist1"><strong>--all-features</strong></dt>
219220
<dd>
@@ -241,6 +242,11 @@ <h3 id="cargo_bench_compilation_options">Compilation Options</h3>
241242
<p>This may also be specified with the <code>build.target</code>
242243
<a href="../reference/config.html">config value</a>.</p>
243244
</div>
245+
<div class="paragraph">
246+
<p>Note that specifying this flag makes Cargo run in a different mode where the
247+
target artifacts are placed in a separate directory. See the
248+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
249+
</div>
244250
</dd>
245251
</dl>
246252
</div>

src/doc/man/generated/cargo-build.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ <h3 id="cargo_build_feature_selection">Feature Selection</h3>
142142
<dd>
143143
<p>Space or comma separated list of features to activate. These features only
144144
apply to the current directory&#8217;s package. Features of direct dependencies
145-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
145+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
146+
specified multiple times, which enables all specified features.</p>
146147
</dd>
147148
<dt class="hdlist1"><strong>--all-features</strong></dt>
148149
<dd>
@@ -170,6 +171,11 @@ <h3 id="cargo_build_compilation_options">Compilation Options</h3>
170171
<p>This may also be specified with the <code>build.target</code>
171172
<a href="../reference/config.html">config value</a>.</p>
172173
</div>
174+
<div class="paragraph">
175+
<p>Note that specifying this flag makes Cargo run in a different mode where the
176+
target artifacts are placed in a separate directory. See the
177+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
178+
</div>
173179
</dd>
174180
<dt class="hdlist1"><strong>--release</strong></dt>
175181
<dd>

src/doc/man/generated/cargo-check.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,8 @@ <h3 id="cargo_check_feature_selection">Feature Selection</h3>
146146
<dd>
147147
<p>Space or comma separated list of features to activate. These features only
148148
apply to the current directory&#8217;s package. Features of direct dependencies
149-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
149+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
150+
specified multiple times, which enables all specified features.</p>
150151
</dd>
151152
<dt class="hdlist1"><strong>--all-features</strong></dt>
152153
<dd>
@@ -174,6 +175,11 @@ <h3 id="cargo_check_compilation_options">Compilation Options</h3>
174175
<p>This may also be specified with the <code>build.target</code>
175176
<a href="../reference/config.html">config value</a>.</p>
176177
</div>
178+
<div class="paragraph">
179+
<p>Note that specifying this flag makes Cargo run in a different mode where the
180+
target artifacts are placed in a separate directory. See the
181+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
182+
</div>
177183
</dd>
178184
<dt class="hdlist1"><strong>--release</strong></dt>
179185
<dd>

src/doc/man/generated/cargo-clean.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,11 @@ <h3 id="cargo_clean_clean_options">Clean Options</h3>
7373
<p>This may also be specified with the <code>build.target</code>
7474
<a href="../reference/config.html">config value</a>.</p>
7575
</div>
76+
<div class="paragraph">
77+
<p>Note that specifying this flag makes Cargo run in a different mode where the
78+
target artifacts are placed in a separate directory. See the
79+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
80+
</div>
7681
</dd>
7782
</dl>
7883
</div>

src/doc/man/generated/cargo-doc.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,8 @@ <h3 id="cargo_doc_feature_selection">Feature Selection</h3>
124124
<dd>
125125
<p>Space or comma separated list of features to activate. These features only
126126
apply to the current directory&#8217;s package. Features of direct dependencies
127-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
127+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
128+
specified multiple times, which enables all specified features.</p>
128129
</dd>
129130
<dt class="hdlist1"><strong>--all-features</strong></dt>
130131
<dd>
@@ -152,6 +153,11 @@ <h3 id="cargo_doc_compilation_options">Compilation Options</h3>
152153
<p>This may also be specified with the <code>build.target</code>
153154
<a href="../reference/config.html">config value</a>.</p>
154155
</div>
156+
<div class="paragraph">
157+
<p>Note that specifying this flag makes Cargo run in a different mode where the
158+
target artifacts are placed in a separate directory. See the
159+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
160+
</div>
155161
</dd>
156162
<dt class="hdlist1"><strong>--release</strong></dt>
157163
<dd>

src/doc/man/generated/cargo-fetch.html

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,11 @@ <h3 id="cargo_fetch_fetch_options">Fetch options</h3>
5050
<p>This may also be specified with the <code>build.target</code>
5151
<a href="../reference/config.html">config value</a>.</p>
5252
</div>
53+
<div class="paragraph">
54+
<p>Note that specifying this flag makes Cargo run in a different mode where the
55+
target artifacts are placed in a separate directory. See the
56+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
57+
</div>
5358
</dd>
5459
</dl>
5560
</div>

src/doc/man/generated/cargo-fix.html

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,25 @@ <h2 id="cargo_fix_description">DESCRIPTION</h2>
3434
</div>
3535
</div>
3636
<div class="paragraph">
37-
<p>which behaves the same as <code>cargo check --all-targets</code>. Similarly if you&#8217;d like
38-
to fix code for different platforms you can do:</p>
37+
<p>which behaves the same as <code>cargo check --all-targets</code>.</p>
38+
</div>
39+
<div class="paragraph">
40+
<p><code>cargo fix</code> is only capable of fixing code that is normally compiled with
41+
<code>cargo check</code>. If code is conditionally enabled with optional features, you
42+
will need to enable those features for that code to be analyzed:</p>
3943
</div>
4044
<div class="literalblock">
4145
<div class="content">
42-
<pre>cargo fix --edition --target x86_64-pc-windows-gnu</pre>
46+
<pre>cargo fix --edition --features foo</pre>
4347
</div>
4448
</div>
4549
<div class="paragraph">
46-
<p>or if your crate has optional features:</p>
50+
<p>Similarly, other <code>cfg</code> expressions like platform-specific code will need to
51+
pass <code>--target</code> to fix code for the given target.</p>
4752
</div>
4853
<div class="literalblock">
4954
<div class="content">
50-
<pre>cargo fix --edition --no-default-features --features foo</pre>
55+
<pre>cargo fix --edition --target x86_64-pc-windows-gnu</pre>
5156
</div>
5257
</div>
5358
<div class="paragraph">
@@ -217,7 +222,8 @@ <h3 id="cargo_fix_feature_selection">Feature Selection</h3>
217222
<dd>
218223
<p>Space or comma separated list of features to activate. These features only
219224
apply to the current directory&#8217;s package. Features of direct dependencies
220-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
225+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
226+
specified multiple times, which enables all specified features.</p>
221227
</dd>
222228
<dt class="hdlist1"><strong>--all-features</strong></dt>
223229
<dd>
@@ -245,6 +251,11 @@ <h3 id="cargo_fix_compilation_options">Compilation Options</h3>
245251
<p>This may also be specified with the <code>build.target</code>
246252
<a href="../reference/config.html">config value</a>.</p>
247253
</div>
254+
<div class="paragraph">
255+
<p>Note that specifying this flag makes Cargo run in a different mode where the
256+
target artifacts are placed in a separate directory. See the
257+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
258+
</div>
248259
</dd>
249260
<dt class="hdlist1"><strong>--release</strong></dt>
250261
<dd>

src/doc/man/generated/cargo-install.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,8 @@ <h3 id="cargo_install_feature_selection">Feature Selection</h3>
212212
<dd>
213213
<p>Space or comma separated list of features to activate. These features only
214214
apply to the current directory&#8217;s package. Features of direct dependencies
215-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
215+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
216+
specified multiple times, which enables all specified features.</p>
216217
</dd>
217218
<dt class="hdlist1"><strong>--all-features</strong></dt>
218219
<dd>
@@ -240,6 +241,11 @@ <h3 id="cargo_install_compilation_options">Compilation Options</h3>
240241
<p>This may also be specified with the <code>build.target</code>
241242
<a href="../reference/config.html">config value</a>.</p>
242243
</div>
244+
<div class="paragraph">
245+
<p>Note that specifying this flag makes Cargo run in a different mode where the
246+
target artifacts are placed in a separate directory. See the
247+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
248+
</div>
243249
</dd>
244250
<dt class="hdlist1"><strong>--debug</strong></dt>
245251
<dd>

src/doc/man/generated/cargo-metadata.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,8 @@ <h3 id="cargo_metadata_feature_selection">Feature Selection</h3>
321321
<dd>
322322
<p>Space or comma separated list of features to activate. These features only
323323
apply to the current directory&#8217;s package. Features of direct dependencies
324-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
324+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
325+
specified multiple times, which enables all specified features.</p>
325326
</dd>
326327
<dt class="hdlist1"><strong>--all-features</strong></dt>
327328
<dd>

src/doc/man/generated/cargo-package.html

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,15 @@ <h2 id="cargo_package_description">DESCRIPTION</h2>
5959
</li>
6060
<li>
6161
<p>Extract the <code>.crate</code> file and build it to verify it can build.</p>
62+
<div class="ulist">
63+
<ul>
64+
<li>
65+
<p>This will rebuild your package from scratch to ensure that it can be
66+
built from a pristine state. The <code>--no-verify</code> flag can be used to skip
67+
this step.</p>
68+
</li>
69+
</ul>
70+
</div>
6271
</li>
6372
<li>
6473
<p>Check that build scripts did not modify any source files.</p>
@@ -117,6 +126,11 @@ <h3 id="cargo_package_compilation_options">Compilation Options</h3>
117126
<p>This may also be specified with the <code>build.target</code>
118127
<a href="../reference/config.html">config value</a>.</p>
119128
</div>
129+
<div class="paragraph">
130+
<p>Note that specifying this flag makes Cargo run in a different mode where the
131+
target artifacts are placed in a separate directory. See the
132+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
133+
</div>
120134
</dd>
121135
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
122136
<dd>
@@ -140,7 +154,8 @@ <h3 id="cargo_package_feature_selection">Feature Selection</h3>
140154
<dd>
141155
<p>Space or comma separated list of features to activate. These features only
142156
apply to the current directory&#8217;s package. Features of direct dependencies
143-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
157+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
158+
specified multiple times, which enables all specified features.</p>
144159
</dd>
145160
<dt class="hdlist1"><strong>--all-features</strong></dt>
146161
<dd>

src/doc/man/generated/cargo-publish.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ <h3 id="cargo_publish_compilation_options">Compilation Options</h3>
110110
<p>This may also be specified with the <code>build.target</code>
111111
<a href="../reference/config.html">config value</a>.</p>
112112
</div>
113+
<div class="paragraph">
114+
<p>Note that specifying this flag makes Cargo run in a different mode where the
115+
target artifacts are placed in a separate directory. See the
116+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
117+
</div>
113118
</dd>
114119
<dt class="hdlist1"><strong>--target-dir</strong> <em>DIRECTORY</em></dt>
115120
<dd>
@@ -133,7 +138,8 @@ <h3 id="cargo_publish_feature_selection">Feature Selection</h3>
133138
<dd>
134139
<p>Space or comma separated list of features to activate. These features only
135140
apply to the current directory&#8217;s package. Features of direct dependencies
136-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
141+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
142+
specified multiple times, which enables all specified features.</p>
137143
</dd>
138144
<dt class="hdlist1"><strong>--all-features</strong></dt>
139145
<dd>

src/doc/man/generated/cargo-run.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ <h3 id="cargo_run_feature_selection">Feature Selection</h3>
7676
<dd>
7777
<p>Space or comma separated list of features to activate. These features only
7878
apply to the current directory&#8217;s package. Features of direct dependencies
79-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
79+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
80+
specified multiple times, which enables all specified features.</p>
8081
</dd>
8182
<dt class="hdlist1"><strong>--all-features</strong></dt>
8283
<dd>
@@ -104,6 +105,11 @@ <h3 id="cargo_run_compilation_options">Compilation Options</h3>
104105
<p>This may also be specified with the <code>build.target</code>
105106
<a href="../reference/config.html">config value</a>.</p>
106107
</div>
108+
<div class="paragraph">
109+
<p>Note that specifying this flag makes Cargo run in a different mode where the
110+
target artifacts are placed in a separate directory. See the
111+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
112+
</div>
107113
</dd>
108114
<dt class="hdlist1"><strong>--release</strong></dt>
109115
<dd>

src/doc/man/generated/cargo-rustc.html

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ <h2 id="cargo_rustc_description">DESCRIPTION</h2>
3131
package the filters of <code>--lib</code>, <code>--bin</code>, etc, must be used to select which
3232
target is compiled.
3333
To pass flags to all compiler processes spawned by Cargo, use the <code>RUSTFLAGS</code>
34-
environment variable or the <code>build.rustflags</code>
35-
<a href="../reference/config.html">config value</a>.</p>
34+
<a href="../reference/environment-variables.html">environment variable</a> or the
35+
<code>build.rustflags</code> <a href="../reference/config.html">config value</a>.</p>
3636
</div>
3737
</div>
3838
</div>
@@ -137,7 +137,8 @@ <h3 id="cargo_rustc_feature_selection">Feature Selection</h3>
137137
<dd>
138138
<p>Space or comma separated list of features to activate. These features only
139139
apply to the current directory&#8217;s package. Features of direct dependencies
140-
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax.</p>
140+
may be enabled with <code>&lt;dep-name&gt;/&lt;feature-name&gt;</code> syntax. This flag may be
141+
specified multiple times, which enables all specified features.</p>
141142
</dd>
142143
<dt class="hdlist1"><strong>--all-features</strong></dt>
143144
<dd>
@@ -165,6 +166,11 @@ <h3 id="cargo_rustc_compilation_options">Compilation Options</h3>
165166
<p>This may also be specified with the <code>build.target</code>
166167
<a href="../reference/config.html">config value</a>.</p>
167168
</div>
169+
<div class="paragraph">
170+
<p>Note that specifying this flag makes Cargo run in a different mode where the
171+
target artifacts are placed in a separate directory. See the
172+
<a href="../guide/build-cache.html">build cache</a> documentation for more details.</p>
173+
</div>
168174
</dd>
169175
<dt class="hdlist1"><strong>--release</strong></dt>
170176
<dd>

0 commit comments

Comments
 (0)