Skip to content

Commit fef7802

Browse files
committed
Auto merge of #6481 - ehuss:man-update, r=alexcrichton
Some minor documentation changes. A few updates for things that changed recently, some things that were wrong/missing, and hopefully some clarifications on some matters. For reviewing, I recommend ignoring the auto-generated .html/.man files and focus on the .md/.adoc files.
2 parents 758cd5c + f78ab2c commit fef7802

Some content is hidden

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

57 files changed

+614
-1739
lines changed

src/doc/man/cargo-bench.adoc

+7-5
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ like `foobar`):
2929

3030
Benchmarks are built with the `--test` option to `rustc` which creates an
3131
executable with a `main` function that automatically runs all functions
32-
annotated with the `#[bench]` attribute. The libtest harness may be disabled
33-
by setting `harness = false` in the target manifest settings, in which case
34-
your code will need to provide its own `main` function to handle running
35-
benchmarks.
32+
annotated with the `#[bench]` attribute. Cargo passes the `--bench` flag to
33+
the test harness to tell it to run only benchmarks.
34+
35+
The libtest harness may be disabled by setting `harness = false` in the target
36+
manifest settings, in which case your code will need to provide its own `main`
37+
function to handle running benchmarks.
3638

3739
== OPTIONS
3840

@@ -49,7 +51,7 @@ include::options-packages.adoc[]
4951
When no target selection options are given, `cargo bench` will build the
5052
following targets of the selected packages:
5153

52-
- lib used to link with binaries and benchmarks
54+
- lib used to link with binaries and benchmarks
5355
- bins (only if benchmark targets are built and required features are
5456
available)
5557
- lib as a benchmark

src/doc/man/cargo-install.adoc

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ include::options-features.adoc[]
9898
include::options-target-triple.adoc[]
9999

100100
*--debug*::
101-
Build in debug mode instead of release mode.
101+
Build with the `dev` profile instead the `release` profile.
102102

103103
=== Miscellaneous Options
104104

src/doc/man/cargo-login.adoc

+1-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cargo-login - Save an API token from the registry locally
1313
== DESCRIPTION
1414

1515
This command will save the API token to disk so that commands that require
16-
authentication (such as man:cargo-publish[1]) will be automatically
16+
authentication, such as man:cargo-publish[1], will be automatically
1717
authenticated. The token is saved in `$CARGO_HOME/credentials`. `CARGO_HOME`
1818
defaults to `.cargo` in your home directory.
1919

@@ -27,10 +27,6 @@ Take care to keep the token secret, it should not be shared with anyone else.
2727

2828
=== Login Options
2929

30-
*--host* _HOST_::
31-
Host to set the token for. This option does not affect the behavior of the
32-
login command, and only affects the message displayed.
33-
3430
include::options-registry.adoc[]
3531

3632
=== Display Options

src/doc/man/cargo-test.adoc

+12-7
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,18 @@ output of `cargo test -- --help`. As an example, this will run all tests with
2828

2929
Tests are built with the `--test` option to `rustc` which creates an
3030
executable with a `main` function that automatically runs all functions
31-
annotated with the `#[test]` attribute in multiple threads. The libtest
32-
harness may be disabled by setting `harness = false` in the target manifest
33-
settings, in which case your code will need to provide its own `main` function
34-
to handle running tests.
31+
annotated with the `\#[test]` attribute in multiple threads. `#[bench]`
32+
annotated functions will also be run with one iteration to verify that they
33+
are functional.
34+
35+
The libtest harness may be disabled by setting `harness = false` in the target
36+
manifest settings, in which case your code will need to provide its own `main`
37+
function to handle running tests.
3538

3639
Documentation tests are also run by default, which is handled by `rustdoc`. It
37-
extracts code samples from documentation comments and executes them.
40+
extracts code samples from documentation comments and executes them. See the
41+
link:https://doc.rust-lang.org/rustdoc/[rustdoc book] for more information on
42+
writing doc tests.
3843

3944
== OPTIONS
4045

@@ -51,10 +56,10 @@ include::options-packages.adoc[]
5156
When no target selection options are given, `cargo test` will build the
5257
following targets of the selected packages:
5358

54-
- lib used to link with binaries, examples, integration tests, and doc tests
59+
- lib used to link with binaries, examples, integration tests, and doc tests
5560
- bins (only if integration tests are built and required features are
5661
available)
57-
- examples to ensure they compile
62+
- examples to ensure they compile
5863
- lib as a unit test
5964
- bins as unit tests
6065
- integration tests

src/doc/man/cargo-update.adoc

+3
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ If `-p` is not specified, all dependencies are updated.
4242
set the package to. If the package comes from a git repository, this can
4343
be a git revision (such as a SHA hash or tag).
4444

45+
*--dry-run*::
46+
Displays what would be updated, but doesn't actually write the lockfile.
47+
4548
=== Display Options
4649

4750
include::options-display.adoc[]

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

+28-49
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,13 @@ <h2 id="cargo_bench_description">DESCRIPTION</h2>
3434
<div class="paragraph">
3535
<p>Benchmarks are built with the <code>--test</code> option to <code>rustc</code> which creates an
3636
executable with a <code>main</code> function that automatically runs all functions
37-
annotated with the <code>#[bench]</code> attribute. The libtest harness may be disabled
38-
by setting <code>harness = false</code> in the target manifest settings, in which case
39-
your code will need to provide its own <code>main</code> function to handle running
40-
benchmarks.</p>
37+
annotated with the <code>#[bench]</code> attribute. Cargo passes the <code>--bench</code> flag to
38+
the test harness to tell it to run only benchmarks.</p>
39+
</div>
40+
<div class="paragraph">
41+
<p>The libtest harness may be disabled by setting <code>harness = false</code> in the target
42+
manifest settings, in which case your code will need to provide its own <code>main</code>
43+
function to handle running benchmarks.</p>
4144
</div>
4245
</div>
4346
</div>
@@ -101,7 +104,7 @@ <h3 id="cargo_bench_target_selection">Target Selection</h3>
101104
<div class="ulist">
102105
<ul>
103106
<li>
104-
<p>lib used to link with binaries and benchmarks</p>
107+
<p>lib used to link with binaries and benchmarks</p>
105108
</li>
106109
<li>
107110
<p>bins (only if benchmark targets are built and required features are
@@ -159,26 +162,32 @@ <h3 id="cargo_bench_target_selection">Target Selection</h3>
159162
</dd>
160163
<dt class="hdlist1"><strong>--tests</strong></dt>
161164
<dd>
162-
<p>Benchmark all tests. This includes both unit tests for libraries and binaries
163-
and integration tests. Targets may be disabled by setting <code>test = false</code>
164-
in the manifest settings for the target. Targets (such as examples) may be
165-
explicitly included by setting <code>test = true</code> in the target settings.</p>
165+
<p>Benchmark all targets in test mode that have the <code>test = true</code> manifest
166+
flag set. By default this includes the library and binaries built as
167+
unittests, and integration tests. Be aware that this will also build any
168+
required dependencies, so the lib target may be built twice (once as a
169+
unittest, and once as a dependency for binaries, integration tests, etc.).
170+
Targets may be enabled or disabled by setting the <code>test</code> flag in the
171+
manifest settings for the target.</p>
166172
</dd>
167173
<dt class="hdlist1"><strong>--bench</strong> <em>NAME</em>&#8230;&#8203;</dt>
168174
<dd>
169175
<p>Benchmark the specified benchmark. This flag may be specified multiple times.</p>
170176
</dd>
171177
<dt class="hdlist1"><strong>--benches</strong></dt>
172178
<dd>
173-
<p>Benchmark all benchmarks. This includes both unit benchmarks for libraries and
174-
binaries and bench targets. Targets may be disabled by setting <code>bench =
175-
false</code> in the manifest settings for the target. Targets (such as examples)
176-
may be explicitly included by setting <code>bench = true</code> in the target
177-
settings.</p>
179+
<p>Benchmark all targets in benchmark mode that have the <code>bench = true</code>
180+
manifest flag set. By default this includes the library and binaries built
181+
as benchmarks, and bench targets. Be aware that this will also build any
182+
required dependencies, so the lib target may be built twice (once as a
183+
benchmark, and once as a dependency for binaries, benchmarks, etc.).
184+
Targets may be enabled or disabled by setting the <code>bench</code> flag in the
185+
manifest settings for the target.</p>
178186
</dd>
179187
<dt class="hdlist1"><strong>--all-targets</strong></dt>
180188
<dd>
181-
<p>Benchmark all targets.</p>
189+
<p>Benchmark all targets. This is equivalent to specifying <code>--lib --bins
190+
--tests --benches --examples</code>.</p>
182191
</dd>
183192
</dl>
184193
</div>
@@ -215,44 +224,14 @@ <h3 id="cargo_bench_compilation_options">Compilation Options</h3>
215224
<dl>
216225
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
217226
<dd>
218-
<p>Benchmark for the given architecture. The default is the host architecture.</p>
219-
<div class="paragraph">
220-
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
221-
</div>
222-
<div class="ulist">
223-
<ul>
224-
<li>
225-
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
226-
<code>thumb</code>, <code>mips</code>, etc.</p>
227-
</li>
228-
<li>
229-
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
230-
etc.</p>
231-
</li>
232-
<li>
233-
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
234-
</li>
235-
<li>
236-
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
237-
typically used for bare-metal without an OS.</p>
238-
</li>
239-
<li>
240-
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
241-
</li>
242-
</ul>
243-
</div>
244-
<div class="openblock">
245-
<div class="content">
246-
<div class="paragraph">
247-
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
248-
supported targets.</p>
249-
</div>
227+
<p>Benchmark for the given architecture. The default is the host
228+
architecture. The general format of the triple is
229+
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
230+
list of supported targets.</p>
250231
<div class="paragraph">
251232
<p>This may also be specified with the <code>build.target</code>
252233
<a href="reference/config.html">config value</a>.</p>
253234
</div>
254-
</div>
255-
</div>
256235
</dd>
257236
</dl>
258237
</div>

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

+27-50
Original file line numberDiff line numberDiff line change
@@ -91,26 +91,32 @@ <h3 id="cargo_build_target_selection">Target Selection</h3>
9191
</dd>
9292
<dt class="hdlist1"><strong>--tests</strong></dt>
9393
<dd>
94-
<p>Build all tests. This includes both unit tests for libraries and binaries
95-
and integration tests. Targets may be disabled by setting <code>test = false</code>
96-
in the manifest settings for the target. Targets (such as examples) may be
97-
explicitly included by setting <code>test = true</code> in the target settings.</p>
94+
<p>Build all targets in test mode that have the <code>test = true</code> manifest
95+
flag set. By default this includes the library and binaries built as
96+
unittests, and integration tests. Be aware that this will also build any
97+
required dependencies, so the lib target may be built twice (once as a
98+
unittest, and once as a dependency for binaries, integration tests, etc.).
99+
Targets may be enabled or disabled by setting the <code>test</code> flag in the
100+
manifest settings for the target.</p>
98101
</dd>
99102
<dt class="hdlist1"><strong>--bench</strong> <em>NAME</em>&#8230;&#8203;</dt>
100103
<dd>
101104
<p>Build the specified benchmark. This flag may be specified multiple times.</p>
102105
</dd>
103106
<dt class="hdlist1"><strong>--benches</strong></dt>
104107
<dd>
105-
<p>Build all benchmarks. This includes both unit benchmarks for libraries and
106-
binaries and bench targets. Targets may be disabled by setting <code>bench =
107-
false</code> in the manifest settings for the target. Targets (such as examples)
108-
may be explicitly included by setting <code>bench = true</code> in the target
109-
settings.</p>
108+
<p>Build all targets in benchmark mode that have the <code>bench = true</code>
109+
manifest flag set. By default this includes the library and binaries built
110+
as benchmarks, and bench targets. Be aware that this will also build any
111+
required dependencies, so the lib target may be built twice (once as a
112+
benchmark, and once as a dependency for binaries, benchmarks, etc.).
113+
Targets may be enabled or disabled by setting the <code>bench</code> flag in the
114+
manifest settings for the target.</p>
110115
</dd>
111116
<dt class="hdlist1"><strong>--all-targets</strong></dt>
112117
<dd>
113-
<p>Build all targets.</p>
118+
<p>Build all targets. This is equivalent to specifying <code>--lib --bins
119+
--tests --benches --examples</code>.</p>
114120
</dd>
115121
</dl>
116122
</div>
@@ -147,48 +153,18 @@ <h3 id="cargo_build_compilation_options">Compilation Options</h3>
147153
<dl>
148154
<dt class="hdlist1"><strong>--target</strong> <em>TRIPLE</em></dt>
149155
<dd>
150-
<p>Build for the given architecture. The default is the host architecture.</p>
151-
<div class="paragraph">
152-
<p>The general format of the triple is <code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code> where:</p>
153-
</div>
154-
<div class="ulist">
155-
<ul>
156-
<li>
157-
<p><code>arch</code> = The base CPU architecture, for example <code>x86_64</code>, <code>i686</code>, <code>arm</code>,
158-
<code>thumb</code>, <code>mips</code>, etc.</p>
159-
</li>
160-
<li>
161-
<p><code>sub</code> = The CPU sub-architecture, for example <code>arm</code> has <code>v7</code>, <code>v7s</code>, <code>v5te</code>,
162-
etc.</p>
163-
</li>
164-
<li>
165-
<p><code>vendor</code> = The vendor, for example <code>unknown</code>, <code>apple</code>, <code>pc</code>, <code>linux</code>, etc.</p>
166-
</li>
167-
<li>
168-
<p><code>sys</code> = The system name, for example <code>linux</code>, <code>windows</code>, etc. <code>none</code> is
169-
typically used for bare-metal without an OS.</p>
170-
</li>
171-
<li>
172-
<p><code>abi</code> = The ABI, for example <code>gnu</code>, <code>android</code>, <code>eabi</code>, etc.</p>
173-
</li>
174-
</ul>
175-
</div>
176-
<div class="openblock">
177-
<div class="content">
178-
<div class="paragraph">
179-
<p>Some parameters may be omitted. Run <code>rustc --print target-list</code> for a list of
180-
supported targets.</p>
181-
</div>
156+
<p>Build for the given architecture. The default is the host
157+
architecture. The general format of the triple is
158+
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>. Run <code>rustc --print target-list</code> for a
159+
list of supported targets.</p>
182160
<div class="paragraph">
183161
<p>This may also be specified with the <code>build.target</code>
184162
<a href="reference/config.html">config value</a>.</p>
185163
</div>
186-
</div>
187-
</div>
188164
</dd>
189165
<dt class="hdlist1"><strong>--release</strong></dt>
190166
<dd>
191-
<p>Build artifacts in release mode, with optimizations. See the
167+
<p>Build optimized artifacts with the <code>release</code> profile. See the
192168
<a href="#cargo_build_profiles">PROFILES</a> section for details on how this affects profile selection.</p>
193169
</dd>
194170
</dl>
@@ -356,11 +332,11 @@ <h2 id="cargo_build_profiles">PROFILES</h2>
356332
<code>dev</code> or <code>test</code> profiles are used. If the <code>--release</code> flag is given, then the
357333
<code>release</code> or <code>bench</code> profiles are used.</p>
358334
</div>
359-
<table class="tableblock frame-all grid-all stretch">
335+
<table class="tableblock frame-all grid-all fit-content">
360336
<colgroup>
361-
<col style="width: 33.3333%;">
362-
<col style="width: 33.3333%;">
363-
<col style="width: 33.3334%;">
337+
<col>
338+
<col>
339+
<col>
364340
</colgroup>
365341
<thead>
366342
<tr>
@@ -376,7 +352,8 @@ <h2 id="cargo_build_profiles">PROFILES</h2>
376352
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>release</code></p></td>
377353
</tr>
378354
<tr>
379-
<td class="tableblock halign-left valign-top"><p class="tableblock">test, bench</p></td>
355+
<td class="tableblock halign-left valign-top"><p class="tableblock">test, bench, or any target<br>
356+
in "test" or "bench" mode</p></td>
380357
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>test</code></p></td>
381358
<td class="tableblock halign-left valign-top"><p class="tableblock"><code>bench</code></p></td>
382359
</tr>

0 commit comments

Comments
 (0)