Skip to content

Commit c974e35

Browse files
committed
Auto merge of #10398 - piggynl:cargo-doc-fixes-1, r=weihanglo
Fix errors in `cargo fetch` usage guide This is a recreation of #9785. 1. By [the doc](https://doc.rust-lang.org/cargo/commands/cargo-build.html#manifest-options), `cargo build` will always access the network unless `--frozen` or `--offline` is present. Instead, `cargo fetch` will fetch dependencies, and which will allow running subsequent Cargo commands in offline mode. 2. A general template was used for `--target` that is not appropriate for `cargo fetch`.
2 parents 06ee229 + 08734a6 commit c974e35

31 files changed

+40
-64
lines changed

src/doc/man/cargo-fetch.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# cargo-fetch(1)
22
{{*set actionverb="Fetch"}}
3+
{{*set target-default-to-all-arch=true}}
34

45
## NAME
56

@@ -13,7 +14,7 @@ cargo-fetch - Fetch dependencies of a package from the network
1314

1415
If a `Cargo.lock` file is available, this command will ensure that all of the
1516
git dependencies and/or registry dependencies are downloaded and locally
16-
available. Subsequent Cargo commands never touch the network after a `cargo
17+
available. Subsequent Cargo commands will be able to run offline after a `cargo
1718
fetch` unless the lock file changes.
1819

1920
If the lock file is not available, then this command will generate the lock

src/doc/man/generated_txt/cargo-fetch.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ SYNOPSIS
99
DESCRIPTION
1010
If a Cargo.lock file is available, this command will ensure that all of
1111
the git dependencies and/or registry dependencies are downloaded and
12-
locally available. Subsequent Cargo commands never touch the network
12+
locally available. Subsequent Cargo commands will be able to run offline
1313
after a cargo fetch unless the lock file changes.
1414

1515
If the lock file is not available, then this command will generate the
@@ -25,8 +25,8 @@ DESCRIPTION
2525
OPTIONS
2626
Fetch options
2727
--target triple
28-
Fetch for the given architecture. The default is the host
29-
architecture. The general format of the triple is
28+
Fetch for the given architecture. The default is all architectures.
29+
The general format of the triple is
3030
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
3131
a list of supported targets.
3232

src/doc/man/includes/options-target-triple.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
{{#option "`--target` _triple_"}}
2-
{{actionverb}} for the given architecture. The default is the host
3-
architecture. The general format of the triple is
2+
{{actionverb}} for the given architecture.
3+
{{~#if target-default-to-all-arch}} The default is all architectures.
4+
{{~else}} The default is the host architecture.
5+
{{~/if}} The general format of the triple is
46
`<arch><sub>-<vendor>-<sys>-<abi>`. Run `rustc --print target-list` for a
57
list of supported targets.
68

src/doc/src/commands/cargo-bench.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ be specified multiple times, which enables all specified features.</dd>
241241
<dl>
242242

243243
<dt class="option-term" id="option-cargo-bench---target"><a class="option-anchor" href="#option-cargo-bench---target"></a><code>--target</code> <em>triple</em></dt>
244-
<dd class="option-desc">Benchmark for the given architecture. The default is the host
245-
architecture. The general format of the triple is
244+
<dd class="option-desc">Benchmark for the given architecture. The default is the host architecture. The general format of the triple is
246245
<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
247246
list of supported targets.</p>
248247
<p>This may also be specified with the <code>build.target</code>

src/doc/src/commands/cargo-build.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,8 +169,7 @@ be specified multiple times, which enables all specified features.</dd>
169169
<dl>
170170

171171
<dt class="option-term" id="option-cargo-build---target"><a class="option-anchor" href="#option-cargo-build---target"></a><code>--target</code> <em>triple</em></dt>
172-
<dd class="option-desc">Build for the given architecture. The default is the host
173-
architecture. The general format of the triple is
172+
<dd class="option-desc">Build for the given architecture. The default is the host architecture. The general format of the triple is
174173
<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
175174
list of supported targets.</p>
176175
<p>This may also be specified with the <code>build.target</code>

src/doc/src/commands/cargo-check.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ be specified multiple times, which enables all specified features.</dd>
174174
<dl>
175175

176176
<dt class="option-term" id="option-cargo-check---target"><a class="option-anchor" href="#option-cargo-check---target"></a><code>--target</code> <em>triple</em></dt>
177-
<dd class="option-desc">Check for the given architecture. The default is the host
178-
architecture. The general format of the triple is
177+
<dd class="option-desc">Check for the given architecture. The default is the host architecture. The general format of the triple is
179178
<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
180179
list of supported targets.</p>
181180
<p>This may also be specified with the <code>build.target</code>

src/doc/src/commands/cargo-clean.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,7 @@ Defaults to <code>target</code> in the root of the workspace.</dd>
5757

5858

5959
<dt class="option-term" id="option-cargo-clean---target"><a class="option-anchor" href="#option-cargo-clean---target"></a><code>--target</code> <em>triple</em></dt>
60-
<dd class="option-desc">Clean for the given architecture. The default is the host
61-
architecture. The general format of the triple is
60+
<dd class="option-desc">Clean for the given architecture. The default is the host architecture. The general format of the triple is
6261
<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
6362
list of supported targets.</p>
6463
<p>This may also be specified with the <code>build.target</code>

src/doc/src/commands/cargo-doc.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,7 @@ be specified multiple times, which enables all specified features.</dd>
152152
<dl>
153153

154154
<dt class="option-term" id="option-cargo-doc---target"><a class="option-anchor" href="#option-cargo-doc---target"></a><code>--target</code> <em>triple</em></dt>
155-
<dd class="option-desc">Document for the given architecture. The default is the host
156-
architecture. The general format of the triple is
155+
<dd class="option-desc">Document for the given architecture. The default is the host architecture. The general format of the triple is
157156
<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
158157
list of supported targets.</p>
159158
<p>This may also be specified with the <code>build.target</code>

src/doc/src/commands/cargo-fetch.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# cargo-fetch(1)
22

33

4+
45
## NAME
56

67
cargo-fetch - Fetch dependencies of a package from the network
@@ -13,7 +14,7 @@ cargo-fetch - Fetch dependencies of a package from the network
1314

1415
If a `Cargo.lock` file is available, this command will ensure that all of the
1516
git dependencies and/or registry dependencies are downloaded and locally
16-
available. Subsequent Cargo commands never touch the network after a `cargo
17+
available. Subsequent Cargo commands will be able to run offline after a `cargo
1718
fetch` unless the lock file changes.
1819

1920
If the lock file is not available, then this command will generate the lock
@@ -31,8 +32,7 @@ you plan to use Cargo without a network with the `--offline` flag.
3132

3233
<dl>
3334
<dt class="option-term" id="option-cargo-fetch---target"><a class="option-anchor" href="#option-cargo-fetch---target"></a><code>--target</code> <em>triple</em></dt>
34-
<dd class="option-desc">Fetch for the given architecture. The default is the host
35-
architecture. The general format of the triple is
35+
<dd class="option-desc">Fetch for the given architecture. The default is all architectures. The general format of the triple is
3636
<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
3737
list of supported targets.</p>
3838
<p>This may also be specified with the <code>build.target</code>

src/doc/src/commands/cargo-fix.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,8 +254,7 @@ be specified multiple times, which enables all specified features.</dd>
254254
<dl>
255255

256256
<dt class="option-term" id="option-cargo-fix---target"><a class="option-anchor" href="#option-cargo-fix---target"></a><code>--target</code> <em>triple</em></dt>
257-
<dd class="option-desc">Fix for the given architecture. The default is the host
258-
architecture. The general format of the triple is
257+
<dd class="option-desc">Fix for the given architecture. The default is the host architecture. The general format of the triple is
259258
<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
260259
list of supported targets.</p>
261260
<p>This may also be specified with the <code>build.target</code>

0 commit comments

Comments
 (0)