Skip to content

Commit 51a437d

Browse files
committed
Auto merge of #9189 - weihanglo:issue-9137, r=ehuss
Document the default location where cargo install emitting build artifacts Resolves #9137 Document the default location where `cargo install` emitting build artifacts.
2 parents 3705519 + a706292 commit 51a437d

29 files changed

+77
-55
lines changed

src/doc/man/cargo-install.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# cargo-install(1)
22
{{*set actionverb="Install"}}
3+
{{*set temp-target-dir=true}}
34

45
## NAME
56

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,11 @@ OPTIONS
190190
also be specified with the CARGO_TARGET_DIR environment variable, or
191191
the build.target-dir config value
192192
<https://doc.rust-lang.org/cargo/reference/config.html>. Defaults to
193-
target in the root of the workspace.
193+
a new temporary folder located in the temporary directory of the
194+
platform.
195+
196+
When using --path, by default it will use target directory in the
197+
workspace of the local crate unless --target-dir is specified.
194198

195199
--debug
196200
Build with the dev profile instead the release profile.
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
{{#option "`--target-dir` _directory_"}}
22
Directory for all generated artifacts and intermediate files. May also be
33
specified with the `CARGO_TARGET_DIR` environment variable, or the
4-
`build.target-dir` [config value](../reference/config.html). Defaults
5-
to `target` in the root of the workspace.
4+
`build.target-dir` [config value](../reference/config.html).
5+
{{#if temp-target-dir}} Defaults to a new temporary folder located in the
6+
temporary directory of the platform.
7+
8+
When using `--path`, by default it will use `target` directory in the workspace
9+
of the local crate unless `--target-dir`
10+
is specified.
11+
{{else}} Defaults to `target` in the root of the workspace.
12+
{{/if}}
613
{{/option}}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,8 @@ target artifacts are placed in a separate directory. See the
250250
<dt class="option-term" id="option-cargo-bench---target-dir"><a class="option-anchor" href="#option-cargo-bench---target-dir"></a><code>--target-dir</code> <em>directory</em></dt>
251251
<dd class="option-desc">Directory for all generated artifacts and intermediate files. May also be
252252
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
253-
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>. Defaults
254-
to <code>target</code> in the root of the workspace.</dd>
253+
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>.
254+
Defaults to <code>target</code> in the root of the workspace.</dd>
255255

256256

257257
</dl>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,8 +196,8 @@ selection.</dd>
196196
<dt class="option-term" id="option-cargo-build---target-dir"><a class="option-anchor" href="#option-cargo-build---target-dir"></a><code>--target-dir</code> <em>directory</em></dt>
197197
<dd class="option-desc">Directory for all generated artifacts and intermediate files. May also be
198198
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
199-
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>. Defaults
200-
to <code>target</code> in the root of the workspace.</dd>
199+
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>.
200+
Defaults to <code>target</code> in the root of the workspace.</dd>
201201

202202

203203

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ used.</dd>
210210
<dt class="option-term" id="option-cargo-check---target-dir"><a class="option-anchor" href="#option-cargo-check---target-dir"></a><code>--target-dir</code> <em>directory</em></dt>
211211
<dd class="option-desc">Directory for all generated artifacts and intermediate files. May also be
212212
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
213-
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>. Defaults
214-
to <code>target</code> in the root of the workspace.</dd>
213+
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>.
214+
Defaults to <code>target</code> in the root of the workspace.</dd>
215215

216216

217217
</dl>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ the target directory.</dd>
4747
<dt class="option-term" id="option-cargo-clean---target-dir"><a class="option-anchor" href="#option-cargo-clean---target-dir"></a><code>--target-dir</code> <em>directory</em></dt>
4848
<dd class="option-desc">Directory for all generated artifacts and intermediate files. May also be
4949
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
50-
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>. Defaults
51-
to <code>target</code> in the root of the workspace.</dd>
50+
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>.
51+
Defaults to <code>target</code> in the root of the workspace.</dd>
5252

5353

5454

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ selection.</dd>
167167
<dt class="option-term" id="option-cargo-doc---target-dir"><a class="option-anchor" href="#option-cargo-doc---target-dir"></a><code>--target-dir</code> <em>directory</em></dt>
168168
<dd class="option-desc">Directory for all generated artifacts and intermediate files. May also be
169169
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
170-
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>. Defaults
171-
to <code>target</code> in the root of the workspace.</dd>
170+
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>.
171+
Defaults to <code>target</code> in the root of the workspace.</dd>
172172

173173

174174
</dl>

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,8 @@ used.</dd>
270270
<dt class="option-term" id="option-cargo-fix---target-dir"><a class="option-anchor" href="#option-cargo-fix---target-dir"></a><code>--target-dir</code> <em>directory</em></dt>
271271
<dd class="option-desc">Directory for all generated artifacts and intermediate files. May also be
272272
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
273-
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>. Defaults
274-
to <code>target</code> in the root of the workspace.</dd>
273+
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>.
274+
Defaults to <code>target</code> in the root of the workspace.</dd>
275275

276276

277277
</dl>

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

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

33

4+
45
## NAME
56

67
cargo-install - Build and install a Rust binary
@@ -215,8 +216,12 @@ target artifacts are placed in a separate directory. See the
215216
<dt class="option-term" id="option-cargo-install---target-dir"><a class="option-anchor" href="#option-cargo-install---target-dir"></a><code>--target-dir</code> <em>directory</em></dt>
216217
<dd class="option-desc">Directory for all generated artifacts and intermediate files. May also be
217218
specified with the <code>CARGO_TARGET_DIR</code> environment variable, or the
218-
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>. Defaults
219-
to <code>target</code> in the root of the workspace.</dd>
219+
<code>build.target-dir</code> <a href="../reference/config.html">config value</a>.
220+
Defaults to a new temporary folder located in the
221+
temporary directory of the platform. </p>
222+
<p>When using <code>--path</code>, by default it will use <code>target</code> directory in the workspace
223+
of the local crate unless <code>--target-dir</code>
224+
is specified.</dd>
220225

221226

222227

0 commit comments

Comments
 (0)