Implement host-target substitution (#15838)

### What does this PR try to resolve?

This PR resolves: https://github.com/rust-lang/cargo/issues/13051

Namely, it allows users to invoke cargo subcommands that accept a
`--target` directive to specify the `host` target, which is later
substituted in the command processing layer by the host's real target
triple (for instance, on most Linux distributions, `cargo build --target
host` would effectively run `cargo build --target
x86_64-unknown-linux-gnu`).

This additionally applies to usage within `config.toml`, like so:

```toml
# .cargo/config.toml

[build]
target = "host"
```
This commit is contained in:
Weihang Lo 2025-08-18 00:01:34 +00:00 committed by GitHub
commit 206e3fe6b3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
47 changed files with 731 additions and 221 deletions

View File

@ -84,15 +84,27 @@ impl CompileKind {
fallback: CompileKindFallback,
) -> CargoResult<Vec<CompileKind>> {
let dedup = |targets: &[String]| {
Ok(targets
let deduplicated_targets = targets
.iter()
.map(|value| Ok(CompileKind::Target(CompileTarget::new(value)?)))
.map(|value| {
// This neatly substitutes the manually-specified `host` target directive
// with the compiling machine's target triple.
if value.as_str() == "host" {
let host_triple = env!("RUST_HOST_TARGET");
Ok(CompileKind::Target(CompileTarget::new(host_triple)?))
} else {
Ok(CompileKind::Target(CompileTarget::new(value.as_str())?))
}
})
// First collect into a set to deduplicate any `--target` passed
// more than once...
.collect::<CargoResult<BTreeSet<_>>>()?
// ... then generate a flat list for everything else to use.
.into_iter()
.collect())
.collect();
Ok(deduplicated_targets)
};
if !targets.is_empty() {

View File

@ -1257,6 +1257,11 @@ fn get_target_triples() -> Vec<clap_complete::CompletionCandidate> {
}
}
// Allow tab-completion for `host` as the desired target.
candidates.push(clap_complete::CompletionCandidate::new("host").help(Some(
concat!("alias for: ", env!("RUST_HOST_TARGET")).into(),
)));
candidates
}

View File

@ -220,11 +220,24 @@ OPTIONS
Compilation Options
--target triple
Benchmark for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Benchmark for the specified target architecture. Flag may be
specified multiple times. The default is the host architecture. The
general format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -137,11 +137,24 @@ OPTIONS
Compilation Options
--target triple
Build for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Build for the specified target architecture. Flag may be specified
multiple times. The default is the host architecture. The general
format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -134,11 +134,24 @@ OPTIONS
Compilation Options
--target triple
Check for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Check for the specified target architecture. Flag may be specified
multiple times. The default is the host architecture. The general
format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -45,11 +45,24 @@ OPTIONS
target in the root of the workspace.
--target triple
Clean for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Clean for the specified target architecture. Flag may be specified
multiple times. The default is the host architecture. The general
format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -116,11 +116,24 @@ OPTIONS
Compilation Options
--target triple
Document for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Document for the specified target architecture. Flag may be
specified multiple times. The default is the host architecture. The
general format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -25,11 +25,24 @@ DESCRIPTION
OPTIONS
Fetch options
--target triple
Fetch for the given architecture. The default is all architectures.
The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Fetch for the specified target architecture. Flag may be specified
multiple times. The default is all architectures. The general format
of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -208,11 +208,24 @@ OPTIONS
Compilation Options
--target triple
Fix for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Fix for the specified target architecture. Flag may be specified
multiple times. The default is the host architecture. The general
format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -186,10 +186,24 @@ OPTIONS
Compilation Options
--target triple
Install for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
Install for the specified target architecture. The default is the
host architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -188,11 +188,24 @@ OPTIONS
Compilation Options
--target triple
Package for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Package for the specified target architecture. Flag may be specified
multiple times. The default is the host architecture. The general
format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -109,11 +109,24 @@ OPTIONS
Compilation Options
--target triple
Publish for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Publish for the specified target architecture. Flag may be specified
multiple times. The default is the host architecture. The general
format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -61,10 +61,24 @@ OPTIONS
Compilation Options
--target triple
Run for the given architecture. The default is the host
Run for the specified target architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets.
<arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -128,11 +128,24 @@ OPTIONS
Compilation Options
--target triple
Build for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Build for the specified target architecture. Flag may be specified
multiple times. The default is the host architecture. The general
format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -128,11 +128,24 @@ OPTIONS
Compilation Options
--target triple
Document for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Document for the specified target architecture. Flag may be
specified multiple times. The default is the host architecture. The
general format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -242,11 +242,24 @@ OPTIONS
Compilation Options
--target triple
Test for the given architecture. The default is the host
architecture. The general format of the triple is
<arch><sub>-<vendor>-<sys>-<abi>. Run rustc --print target-list for
a list of supported targets. This flag may be specified multiple
times.
Test for the specified target architecture. Flag may be specified
multiple times. The default is the host architecture. The general
format of the triple is <arch><sub>-<vendor>-<sys>-<abi>.
Possible values:
o Any supported target in rustc --print target-list.
o "host", which will internally be substituted by the hosts
target. This can be particularly useful if youre
cross-compiling some crates, and dont want to specify your
hosts machine as a target (for instance, an xtask in a shared
project that may be worked on by many hosts).
o A path to a custom target specification. See Custom Target Lookup
Path
<https://doc.rust-lang.org/rustc/targets/custom.html#custom-target-lookup-path>
for more information.
This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.

View File

@ -1,14 +1,17 @@
{{#option "`--target` _triple_"}}
{{actionverb}} for the given architecture.
{{actionverb}} for the specified target architecture. {{~#if multitarget }} Flag may be specified multiple times. {{~/if}}
{{~#if target-default-to-all-arch}} The default is all architectures.
{{~else}} The default is the host architecture.
{{~/if}} The general format of the triple is
`<arch><sub>-<vendor>-<sys>-<abi>`. Run `rustc --print target-list` for a
list of supported targets.
{{~#if multitarget }} This flag may be specified multiple times. {{~/if}}
`<arch><sub>-<vendor>-<sys>-<abi>`.
This may also be specified with the `build.target`
[config value](../reference/config.html).
Possible values:
- Any supported target in `rustc --print target-list`.
- `"host"`, which will internally be substituted by the host's target. This can be particularly useful if you're cross-compiling some crates, and don't want to specify your host's machine as a target (for instance, an `xtask` in a shared project that may be worked on by many hosts).
- A path to a custom target specification. See [Custom Target Lookup Path](../../rustc/targets/custom.html#custom-target-lookup-path) for more information.
This may also be specified with the `build.target` [config value](../reference/config.html).
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -256,11 +256,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<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>
<dd class="option-desc">Benchmark for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Benchmark for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -171,11 +171,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<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>
<dd class="option-desc">Build for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Build for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -167,11 +167,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<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>
<dd class="option-desc">Check for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Check for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -59,11 +59,15 @@ Defaults to <code>target</code> in the root of the workspace.</dd>
<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>
<dd class="option-desc">Clean for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Clean for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -148,11 +148,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<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>
<dd class="option-desc">Document for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Document for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -29,11 +29,15 @@ you plan to use Cargo without a network with the `--offline` flag.
<dl>
<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>
<dd class="option-desc">Fetch for the given architecture. The default is all architectures. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Fetch for the specified target architecture. Flag may be specified multiple times. The default is all architectures. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -247,11 +247,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<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>
<dd class="option-desc">Fix for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Fix for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -212,11 +212,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<dt class="option-term" id="option-cargo-install---target"><a class="option-anchor" href="#option-cargo-install---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Install for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Install for the specified target architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -202,11 +202,15 @@ single quotes or double quotes around each pattern.</dd>
<dl>
<dt class="option-term" id="option-cargo-package---target"><a class="option-anchor" href="#option-cargo-package---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Package for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Package for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -122,11 +122,15 @@ single quotes or double quotes around each pattern.</dd>
<dl>
<dt class="option-term" id="option-cargo-publish---target"><a class="option-anchor" href="#option-cargo-publish---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Publish for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Publish for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -88,11 +88,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<dt class="option-term" id="option-cargo-run---target"><a class="option-anchor" href="#option-cargo-run---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Run for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Run for the specified target architecture. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -160,11 +160,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<dt class="option-term" id="option-cargo-rustc---target"><a class="option-anchor" href="#option-cargo-rustc---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Build for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Build for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -166,11 +166,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<dt class="option-term" id="option-cargo-rustdoc---target"><a class="option-anchor" href="#option-cargo-rustdoc---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Document for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Document for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -278,11 +278,15 @@ be specified multiple times, which enables all specified features.</dd>
<dl>
<dt class="option-term" id="option-cargo-test---target"><a class="option-anchor" href="#option-cargo-test---target"></a><code>--target</code> <em>triple</em></dt>
<dd class="option-desc">Test for the given architecture. The default is the host architecture. The general format of the triple is
<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
list of supported targets. This flag may be specified multiple times.</p>
<p>This may also be specified with the <code>build.target</code>
<a href="../reference/config.html">config value</a>.</p>
<dd class="option-desc">Test for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
<code>&lt;arch&gt;&lt;sub&gt;-&lt;vendor&gt;-&lt;sys&gt;-&lt;abi&gt;</code>.</p>
<p>Possible values:</p>
<ul>
<li>Any supported target in <code>rustc --print target-list</code>.</li>
<li><code>"host"</code>, which will internally be substituted by the hosts target. This can be particularly useful if youre cross-compiling some crates, and dont want to specify your hosts machine as a target (for instance, an <code>xtask</code> in a shared project that may be worked on by many hosts).</li>
<li>A path to a custom target specification. See <a href="../../rustc/targets/custom.html#custom-target-lookup-path">Custom Target Lookup Path</a> for more information.</li>
</ul>
<p>This may also be specified with the <code>build.target</code> <a href="../reference/config.html">config value</a>.</p>
<p>Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the
<a href="../reference/build-cache.html">build cache</a> documentation for more details.</dd>

View File

@ -460,11 +460,10 @@ Sets the executable to use for `rustdoc`.
The default [target platform triples][target triple] to compile to.
This allows passing either a string or an array of strings. Each string value
is a target platform triple. The selected build targets will be built for each
of the selected architectures.
The string value may also be a relative path to a `.json` target spec file.
Possible values:
- Any supported target in `rustc --print target-list`.
- `"host"`, which will internally be substituted by the host's target. This can be particularly useful if you're cross-compiling some crates, and don't want to specify your host's machine as a target (for instance, an `xtask` in a shared project that may be worked on by many hosts).
- A path to a custom target specification. See [Custom Target Lookup Path](../../rustc/targets/custom.html#custom-target-lookup-path) for more information.
Can be overridden with the `--target` CLI option.

View File

@ -267,12 +267,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Benchmark for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Benchmark for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -166,12 +166,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Build for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Build for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -162,12 +162,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Check for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Check for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -57,12 +57,24 @@ Defaults to \fBtarget\fR in the root of the workspace.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Clean for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Clean for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -137,12 +137,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Document for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Document for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -25,12 +25,24 @@ you plan to use Cargo without a network with the \fB\-\-offline\fR flag.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Fetch for the given architecture. The default is all architectures. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Fetch for the specified target architecture. Flag may be specified multiple times. The default is all architectures. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -257,12 +257,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Fix for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Fix for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -242,12 +242,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Install for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
Install for the specified target architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -239,12 +239,24 @@ single quotes or double quotes around each pattern.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Package for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Package for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -132,12 +132,24 @@ single quotes or double quotes around each pattern.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Publish for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Publish for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -72,12 +72,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Run for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets.
Run for the specified target architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -152,12 +152,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Build for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Build for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -154,12 +154,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Document for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Document for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -287,12 +287,24 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.sp
\fB\-\-target\fR \fItriple\fR
.RS 4
Test for the given architecture. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&. Run \fBrustc \-\-print target\-list\fR for a
list of supported targets. This flag may be specified multiple times.
Test for the specified target architecture. Flag may be specified multiple times. The default is the host architecture. The general format of the triple is
\fB<arch><sub>\-<vendor>\-<sys>\-<abi>\fR\&.
.sp
This may also be specified with the \fBbuild.target\fR
\fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
Possible values:
.sp
.RS 4
\h'-04'\(bu\h'+03'Any supported target in \fBrustc \-\-print target\-list\fR\&.
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'\fB"host"\fR, which will internally be substituted by the host\[cq]s target. This can be particularly useful if you\[cq]re cross\-compiling some crates, and don\[cq]t want to specify your host\[cq]s machine as a target (for instance, an \fBxtask\fR in a shared project that may be worked on by many hosts).
.RE
.sp
.RS 4
\h'-04'\(bu\h'+03'A path to a custom target specification. See \fICustom Target Lookup Path\fR <https://doc.rust\-lang.org/rustc/targets/custom.html#custom\-target\-lookup\-path> for more information.
.RE
.sp
This may also be specified with the \fBbuild.target\fR \fIconfig value\fR <https://doc.rust\-lang.org/cargo/reference/config.html>\&.
.sp
Note that specifying this flag makes Cargo run in a different mode where the
target artifacts are placed in a separate directory. See the

View File

@ -125,6 +125,89 @@ fn simple_cross_config() {
}
}
#[cargo_test]
fn target_host_arg() {
if cross_compile_disabled() {
return;
}
let p = project()
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.0"
edition = "2015"
authors = []
build = "build.rs"
"#,
)
.file(
"build.rs",
&format!(
r#"
fn main() {{
assert_eq!(std::env::var("TARGET").unwrap(), "{}");
}}
"#,
rustc_host()
),
)
.file("src/lib.rs", r#""#)
.build();
p.cargo("build -v --target host")
.with_stderr_contains("[RUNNING] `rustc [..] --target [HOST_TARGET] [..]`")
.run();
}
#[cargo_test]
fn target_host_config() {
if cross_compile_disabled() {
return;
}
let p = project()
.file(
".cargo/config.toml",
&format!(
r#"
[build]
target = "host"
"#,
),
)
.file(
"Cargo.toml",
r#"
[package]
name = "foo"
version = "0.0.0"
edition = "2015"
authors = []
build = "build.rs"
"#,
)
.file(
"build.rs",
&format!(
r#"
fn main() {{
assert_eq!(std::env::var("TARGET").unwrap(), "{}");
}}
"#,
rustc_host()
),
)
.file("src/lib.rs", r#""#)
.build();
p.cargo("build -v")
.with_stderr_contains("[RUNNING] `rustc [..] --target [HOST_TARGET] [..]`")
.run();
}
#[cargo_test]
fn simple_deps() {
if cross_compile_disabled() {