diff --git a/src/doc/man/cargo-bench.md b/src/doc/man/cargo-bench.md
index f43e5b24f868..1155ac50b92c 100644
--- a/src/doc/man/cargo-bench.md
+++ b/src/doc/man/cargo-bench.md
@@ -1,6 +1,7 @@
# cargo-bench(1)
{{*set actionverb="Benchmark"}}
{{*set nouns="benchmarks"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-build.md b/src/doc/man/cargo-build.md
index e4dc63f5b28b..3b71ae6a3171 100644
--- a/src/doc/man/cargo-build.md
+++ b/src/doc/man/cargo-build.md
@@ -1,5 +1,6 @@
# cargo-build(1)
{{*set actionverb="Build"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-check.md b/src/doc/man/cargo-check.md
index 208cd273406c..44a3d0fdc4d9 100644
--- a/src/doc/man/cargo-check.md
+++ b/src/doc/man/cargo-check.md
@@ -1,5 +1,6 @@
# cargo-check(1)
{{*set actionverb="Check"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-clean.md b/src/doc/man/cargo-clean.md
index aa6315632483..be1fa1fce454 100644
--- a/src/doc/man/cargo-clean.md
+++ b/src/doc/man/cargo-clean.md
@@ -1,5 +1,6 @@
# cargo-clean(1)
{{*set actionverb="Clean"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-doc.md b/src/doc/man/cargo-doc.md
index 5e33541395f1..f8f517d9ae70 100644
--- a/src/doc/man/cargo-doc.md
+++ b/src/doc/man/cargo-doc.md
@@ -1,5 +1,6 @@
# cargo-doc(1)
{{*set actionverb="Document"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-fetch.md b/src/doc/man/cargo-fetch.md
index 601ddb248cdc..69ce103cae30 100644
--- a/src/doc/man/cargo-fetch.md
+++ b/src/doc/man/cargo-fetch.md
@@ -1,6 +1,7 @@
# cargo-fetch(1)
{{*set actionverb="Fetch"}}
{{*set target-default-to-all-arch=true}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-fix.md b/src/doc/man/cargo-fix.md
index 53dfb4cc6225..e78ae34fd2e0 100644
--- a/src/doc/man/cargo-fix.md
+++ b/src/doc/man/cargo-fix.md
@@ -1,5 +1,6 @@
# cargo-fix(1)
{{*set actionverb="Fix"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-package.md b/src/doc/man/cargo-package.md
index 1180df718efd..d7f35c6234c8 100644
--- a/src/doc/man/cargo-package.md
+++ b/src/doc/man/cargo-package.md
@@ -1,6 +1,7 @@
# cargo-package(1)
{{*set actionverb="Package"}}
{{*set noall=true}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-publish.md b/src/doc/man/cargo-publish.md
index 6033b238d4ad..560e3c104728 100644
--- a/src/doc/man/cargo-publish.md
+++ b/src/doc/man/cargo-publish.md
@@ -1,5 +1,6 @@
# cargo-publish(1)
{{*set actionverb="Publish"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-rustc.md b/src/doc/man/cargo-rustc.md
index 32d3b0e5be7b..588c080a9e09 100644
--- a/src/doc/man/cargo-rustc.md
+++ b/src/doc/man/cargo-rustc.md
@@ -1,5 +1,6 @@
# cargo-rustc(1)
{{*set actionverb="Build"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-rustdoc.md b/src/doc/man/cargo-rustdoc.md
index 2e4b6e21626b..6c38780f3244 100644
--- a/src/doc/man/cargo-rustdoc.md
+++ b/src/doc/man/cargo-rustdoc.md
@@ -1,5 +1,6 @@
# cargo-rustdoc(1)
{{*set actionverb="Document"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/cargo-test.md b/src/doc/man/cargo-test.md
index b948d91c24cb..7419b5323979 100644
--- a/src/doc/man/cargo-test.md
+++ b/src/doc/man/cargo-test.md
@@ -1,6 +1,7 @@
# cargo-test(1)
{{*set actionverb="Test"}}
{{*set nouns="tests"}}
+{{*set multitarget=true}}
## NAME
diff --git a/src/doc/man/generated_txt/cargo-bench.txt b/src/doc/man/generated_txt/cargo-bench.txt
index 01afc593cacf..876442b09d8b 100644
--- a/src/doc/man/generated_txt/cargo-bench.txt
+++ b/src/doc/man/generated_txt/cargo-bench.txt
@@ -208,7 +208,8 @@ OPTIONS
Benchmark for the given architecture. The default is the host
architecture. The general format of the triple is
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-build.md b/src/doc/src/commands/cargo-build.md index 3f473de7a7dc..b69012142b92 100644 --- a/src/doc/src/commands/cargo-build.md +++ b/src/doc/src/commands/cargo-build.md @@ -1,6 +1,7 @@ # cargo-build(1) + ## NAME cargo-build - Compile the current package @@ -182,7 +183,7 @@ be specified multiple times, which enables all specified features.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-check.md b/src/doc/src/commands/cargo-check.md index 7ea0651901af..16935a756a6b 100644 --- a/src/doc/src/commands/cargo-check.md +++ b/src/doc/src/commands/cargo-check.md @@ -1,6 +1,7 @@ # cargo-check(1) + ## NAME cargo-check - Check the current package @@ -177,7 +178,7 @@ be specified multiple times, which enables all specified features.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the
diff --git a/src/doc/src/commands/cargo-clean.md b/src/doc/src/commands/cargo-clean.md
index d2e46620471b..eee69854dc64 100644
--- a/src/doc/src/commands/cargo-clean.md
+++ b/src/doc/src/commands/cargo-clean.md
@@ -1,6 +1,7 @@
# cargo-clean(1)
+
## NAME
cargo-clean - Remove generated artifacts
@@ -59,7 +60,7 @@ Defaults to target
in the root of the workspace.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-doc.md b/src/doc/src/commands/cargo-doc.md index b28020c9d746..5bcd73689e7b 100644 --- a/src/doc/src/commands/cargo-doc.md +++ b/src/doc/src/commands/cargo-doc.md @@ -1,6 +1,7 @@ # cargo-doc(1) + ## NAME cargo-doc - Build a package's documentation @@ -155,7 +156,7 @@ be specified multiple times, which enables all specified features.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-fetch.md b/src/doc/src/commands/cargo-fetch.md index 7cdd4543e132..9248fb98aebe 100644 --- a/src/doc/src/commands/cargo-fetch.md +++ b/src/doc/src/commands/cargo-fetch.md @@ -2,6 +2,7 @@ + ## NAME cargo-fetch - Fetch dependencies of a package from the network @@ -34,7 +35,7 @@ you plan to use Cargo without a network with the `--offline` flag.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-fix.md b/src/doc/src/commands/cargo-fix.md index d75d81a44bfe..85ca570f8eae 100644 --- a/src/doc/src/commands/cargo-fix.md +++ b/src/doc/src/commands/cargo-fix.md @@ -1,6 +1,7 @@ # cargo-fix(1) + ## NAME cargo-fix - Automatically fix lint warnings reported by rustc @@ -257,7 +258,7 @@ be specified multiple times, which enables all specified features.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-package.md b/src/doc/src/commands/cargo-package.md index 568880a0d481..1a9dac0b7995 100644 --- a/src/doc/src/commands/cargo-package.md +++ b/src/doc/src/commands/cargo-package.md @@ -2,6 +2,7 @@ + ## NAME cargo-package - Assemble the local package into a distributable tarball @@ -133,7 +134,7 @@ single quotes or double quotes around each pattern.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-publish.md b/src/doc/src/commands/cargo-publish.md index e4489416e06d..af5c12776f9e 100644 --- a/src/doc/src/commands/cargo-publish.md +++ b/src/doc/src/commands/cargo-publish.md @@ -1,6 +1,7 @@ # cargo-publish(1) + ## NAME cargo-publish - Upload a package to the registry @@ -99,7 +100,7 @@ format.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-rustc.md b/src/doc/src/commands/cargo-rustc.md index 7396d679e2e9..f0d85718e1d0 100644 --- a/src/doc/src/commands/cargo-rustc.md +++ b/src/doc/src/commands/cargo-rustc.md @@ -1,6 +1,7 @@ # cargo-rustc(1) + ## NAME cargo-rustc - Compile the current package, and pass extra options to the compiler @@ -169,7 +170,7 @@ be specified multiple times, which enables all specified features.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-rustdoc.md b/src/doc/src/commands/cargo-rustdoc.md index 1fe506d108ed..8f795050519a 100644 --- a/src/doc/src/commands/cargo-rustdoc.md +++ b/src/doc/src/commands/cargo-rustdoc.md @@ -1,6 +1,7 @@ # cargo-rustdoc(1) + ## NAME cargo-rustdoc - Build a package's documentation, using specified custom flags @@ -174,7 +175,7 @@ be specified multiple times, which enables all specified features.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the diff --git a/src/doc/src/commands/cargo-test.md b/src/doc/src/commands/cargo-test.md index 9ff65a107239..8e7a812e9952 100644 --- a/src/doc/src/commands/cargo-test.md +++ b/src/doc/src/commands/cargo-test.md @@ -2,6 +2,7 @@ + ## NAME cargo-test - Execute unit and integration tests of a package @@ -269,7 +270,7 @@ be specified multiple times, which enables all specified features.
--target
triple<arch><sub>-<vendor>-<sys>-<abi>
. Run rustc --print target-list
for a
-list of supported targets.
+list of supported targets. This flag may be specified multiple times.
This may also be specified with the build.target
config value.
Note that specifying this flag makes Cargo run in a different mode where the
diff --git a/src/doc/src/reference/config.md b/src/doc/src/reference/config.md
index f4749457e7a5..ee4430fb360d 100644
--- a/src/doc/src/reference/config.md
+++ b/src/doc/src/reference/config.md
@@ -380,16 +380,25 @@ It affects the filename hash so that artifacts produced by the wrapper are cache
Sets the executable to use for `rustdoc`.
##### `build.target`
-* Type: string
+* Type: string or array of strings
* Default: host platform
* Environment: `CARGO_BUILD_TARGET`
-The default target platform triple to compile to.
+The default target platform triples to compile to.
-This may also be a relative path to a `.json` target spec file.
+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.
Can be overridden with the `--target` CLI option.
+```toml
+[build]
+target = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"]
+```
+
##### `build.target-dir`
* Type: string (path)
* Default: "target"
diff --git a/src/doc/src/reference/unstable.md b/src/doc/src/reference/unstable.md
index 3d0031180da1..446b5190d906 100644
--- a/src/doc/src/reference/unstable.md
+++ b/src/doc/src/reference/unstable.md
@@ -48,7 +48,7 @@ how the feature works:
```toml
[unstable]
mtime-on-use = true
- multitarget = true
+ build-std = ["core", "alloc"]
```
Each new feature described below should explain how to use it.
@@ -76,7 +76,6 @@ Each new feature described below should explain how to use it.
* Compile behavior
* [mtime-on-use](#mtime-on-use) — Updates the last-modified timestamp on every dependency every time it is used, to provide a mechanism to delete unused artifacts.
* [doctest-xcompile](#doctest-xcompile) — Supports running doctests with the `--target` flag.
- * [multitarget](#multitarget) — Supports building for multiple targets at the same time.
* [build-std](#build-std) — Builds the standard library instead of using pre-built binaries.
* [build-std-features](#build-std-features) — Sets features to use with the standard library.
* [binary-dep-depinfo](#binary-dep-depinfo) — Causes the dep-info file to track binary dependencies.
@@ -217,32 +216,6 @@ information from `.cargo/config.toml`. See the rustc issue for more information.
cargo test --target foo -Zdoctest-xcompile
```
-### multitarget
-* Tracking Issue: [#8176](https://github.com/rust-lang/cargo/issues/8176)
-
-This flag allows passing multiple `--target` flags to the `cargo` subcommand
-selected. When multiple `--target` flags are passed the selected build targets
-will be built for each of the selected architectures.
-
-For example to compile a library for both 32 and 64-bit:
-
-```
-cargo build --target x86_64-unknown-linux-gnu --target i686-unknown-linux-gnu
-```
-
-or running tests for both targets:
-
-```
-cargo test --target x86_64-unknown-linux-gnu --target i686-unknown-linux-gnu
-```
-
-This can also be specified in `.cargo/config.toml` files.
-
-```toml
-[build]
-target = ["x86_64-unknown-linux-gnu", "i686-unknown-linux-gnu"]
-```
-
#### New `dir-name` attribute
Some of the paths generated under `target/` have resulted in a de-facto "build
@@ -1568,3 +1541,9 @@ unstable and require `-Zunstable-options`.)
The `--config` CLI option has been stabilized in the 1.63 release. See
the [config documentation](config.html#command-line-overrides) for more
information.
+
+### multitarget
+
+The `-Z multitarget` option has been stabilized in the 1.64 release.
+See [`build.target`](config.md#buildtarget) for more information about
+setting the default target platform triples.
diff --git a/src/etc/man/cargo-bench.1 b/src/etc/man/cargo-bench.1
index 002f7562a212..21e07fbbcd66 100644
--- a/src/etc/man/cargo-bench.1
+++ b/src/etc/man/cargo-bench.1
@@ -257,7 +257,7 @@ Do not activate the \fBdefault\fR feature of the selected packages.
.RS 4
Benchmark for the given architecture. The default is the host architecture. The general format of the triple is
\fB