Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stabilize -Zmultitarget #10766

Merged
merged 3 commits into from
Jul 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/cargo/core/compiler/compile_kind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::core::Target;
use crate::util::errors::CargoResult;
use crate::util::interning::InternedString;
use crate::util::{Config, StableHasher};
use anyhow::{bail, Context as _};
use anyhow::Context as _;
use serde::Serialize;
use std::collections::BTreeSet;
use std::fs;
Expand Down Expand Up @@ -65,9 +65,6 @@ impl CompileKind {
};

if !targets.is_empty() {
if targets.len() > 1 && !config.cli_unstable().multitarget {
bail!("specifying multiple `--target` flags requires `-Zmultitarget`")
}
return dedup(targets);
}

Expand Down
4 changes: 3 additions & 1 deletion src/cargo/core/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -722,6 +722,8 @@ const STABILISED_NAMESPACED_FEATURES: &str = "Namespaced features are now always

const STABILIZED_TIMINGS: &str = "The -Ztimings option has been stabilized as --timings.";

const STABILISED_MULTITARGET: &str = "Multiple `--target` options are now always available.";

fn deserialize_build_std<'de, D>(deserializer: D) -> Result<Option<Vec<String>>, D::Error>
where
D: serde::Deserializer<'de>,
Expand Down Expand Up @@ -922,7 +924,7 @@ impl CliUnstable {
self.features = Some(feats);
}
"separate-nightlies" => self.separate_nightlies = parse_empty(k, v)?,
"multitarget" => self.multitarget = parse_empty(k, v)?,
"multitarget" => stabilized_warn(k, "1.64", STABILISED_MULTITARGET),
"rustdoc-map" => self.rustdoc_map = parse_empty(k, v)?,
"terminal-width" => self.terminal_width = Some(parse_usize_opt(v)?),
"sparse-registry" => self.sparse_registry = parse_empty(k, v)?,
Expand Down
8 changes: 1 addition & 7 deletions src/cargo/util/config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2248,13 +2248,7 @@ impl BuildTargetConfig {
};
let values = match &self.inner.val {
BuildTargetConfigInner::One(s) => vec![map(s)],
BuildTargetConfigInner::Many(v) => {
if !config.cli_unstable().multitarget {
bail!("specifying an array in `build.target` config value requires `-Zmultitarget`")
} else {
v.iter().map(map).collect()
}
}
BuildTargetConfigInner::Many(v) => v.iter().map(map).collect(),
};
Ok(values)
}
Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-bench.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-bench(1)
{{*set actionverb="Benchmark"}}
{{*set nouns="benchmarks"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-build.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cargo-build(1)
{{*set actionverb="Build"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-check.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cargo-check(1)
{{*set actionverb="Check"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-clean.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cargo-clean(1)
{{*set actionverb="Clean"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-doc.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cargo-doc(1)
{{*set actionverb="Document"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-fetch.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-fetch(1)
{{*set actionverb="Fetch"}}
{{*set target-default-to-all-arch=true}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-fix.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cargo-fix(1)
{{*set actionverb="Fix"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-package.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-package(1)
{{*set actionverb="Package"}}
{{*set noall=true}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-publish.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cargo-publish(1)
{{*set actionverb="Publish"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-rustc.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cargo-rustc(1)
{{*set actionverb="Build"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-rustdoc.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# cargo-rustdoc(1)
{{*set actionverb="Document"}}
{{*set multitarget=true}}

## NAME

Expand Down
1 change: 1 addition & 0 deletions src/doc/man/cargo-test.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-test(1)
{{*set actionverb="Test"}}
{{*set nouns="tests"}}
{{*set multitarget=true}}

## NAME

Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-bench.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-check.txt
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-clean.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-doc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-fetch.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-fix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-package.txt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-publish.txt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-rustc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-rustdoc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
3 changes: 2 additions & 1 deletion src/doc/man/generated_txt/cargo-test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,8 @@ OPTIONS
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.
a list of supported targets. This flag may be specified multiple
times.

This may also be specified with the build.target config value
<https://doc.rust-lang.org/cargo/reference/config.html>.
Expand Down
1 change: 1 addition & 0 deletions src/doc/man/includes/options-target-triple.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
{{~/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}}

This may also be specified with the `build.target`
[config value](../reference/config.html).
Expand Down
3 changes: 2 additions & 1 deletion src/doc/src/commands/cargo-bench.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@




## NAME

cargo-bench - Execute benchmarks of a package
Expand Down Expand Up @@ -255,7 +256,7 @@ be specified multiple times, which enables all specified features.</dd>
<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.</p>
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>
<p>Note that specifying this flag makes Cargo run in a different mode where the
Expand Down
3 changes: 2 additions & 1 deletion src/doc/src/commands/cargo-build.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-build(1)



## NAME

cargo-build - Compile the current package
Expand Down Expand Up @@ -182,7 +183,7 @@ be specified multiple times, which enables all specified features.</dd>
<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.</p>
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>
<p>Note that specifying this flag makes Cargo run in a different mode where the
Expand Down
3 changes: 2 additions & 1 deletion src/doc/src/commands/cargo-check.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-check(1)



## NAME

cargo-check - Check the current package
Expand Down Expand Up @@ -177,7 +178,7 @@ be specified multiple times, which enables all specified features.</dd>
<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.</p>
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>
<p>Note that specifying this flag makes Cargo run in a different mode where the
Expand Down
3 changes: 2 additions & 1 deletion src/doc/src/commands/cargo-clean.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-clean(1)



## NAME

cargo-clean - Remove generated artifacts
Expand Down Expand Up @@ -59,7 +60,7 @@ 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.</p>
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>
<p>Note that specifying this flag makes Cargo run in a different mode where the
Expand Down
3 changes: 2 additions & 1 deletion src/doc/src/commands/cargo-doc.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-doc(1)



## NAME

cargo-doc - Build a package's documentation
Expand Down Expand Up @@ -155,7 +156,7 @@ be specified multiple times, which enables all specified features.</dd>
<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.</p>
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>
<p>Note that specifying this flag makes Cargo run in a different mode where the
Expand Down
3 changes: 2 additions & 1 deletion src/doc/src/commands/cargo-fetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@




## NAME

cargo-fetch - Fetch dependencies of a package from the network
Expand Down Expand Up @@ -34,7 +35,7 @@ you plan to use Cargo without a network with the `--offline` flag.
<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.</p>
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>
<p>Note that specifying this flag makes Cargo run in a different mode where the
Expand Down
3 changes: 2 additions & 1 deletion src/doc/src/commands/cargo-fix.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# cargo-fix(1)



## NAME

cargo-fix - Automatically fix lint warnings reported by rustc
Expand Down Expand Up @@ -257,7 +258,7 @@ be specified multiple times, which enables all specified features.</dd>
<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.</p>
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>
<p>Note that specifying this flag makes Cargo run in a different mode where the
Expand Down
Loading