Skip to content

Commit f293272

Browse files
authored
fix: use host-tuple for host target subsitution (#16003)
### What does this PR try to resolve? The "host" string is ambiguous * We have `-Zhost-config` that config `[host]` table applies to artifacts running on host, such as build scripts and proc macros. * `host` sounds like the default behavior, whereas `--target host` is in the cross-compilation mode: `target/<triple>/debug`. * We might want to reserve `host` for future use This should address both concerns in <#13051 (comment)>: * "host-tuple" is aligned with `rustc --print host-tuple`, and doesn't sound like a default behavior. * Given "host" is not used, we reserved the future possibility to reset to the default behavior
2 parents 113761f + a5c8b96 commit f293272

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+68
-66
lines changed

src/cargo/core/compiler/compile_kind.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ impl CompileKind {
8787
let deduplicated_targets = targets
8888
.iter()
8989
.map(|value| {
90-
// This neatly substitutes the manually-specified `host` target directive
90+
// This neatly substitutes the manually-specified `host-tuple` target directive
9191
// with the compiling machine's target triple.
9292

93-
if value.as_str() == "host" {
93+
if value.as_str() == "host-tuple" {
9494
let host_triple = env!("RUST_HOST_TARGET");
9595
Ok(CompileKind::Target(CompileTarget::new(host_triple)?))
9696
} else {

src/cargo/util/command_prelude.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,10 +1263,12 @@ fn get_target_triples() -> Vec<clap_complete::CompletionCandidate> {
12631263
}
12641264
}
12651265

1266-
// Allow tab-completion for `host` as the desired target.
1267-
candidates.push(clap_complete::CompletionCandidate::new("host").help(Some(
1268-
concat!("alias for: ", env!("RUST_HOST_TARGET")).into(),
1269-
)));
1266+
// Allow tab-completion for `host-tuple` as the desired target.
1267+
candidates.push(
1268+
clap_complete::CompletionCandidate::new("host-tuple").help(Some(
1269+
concat!("alias for: ", env!("RUST_HOST_TARGET")).into(),
1270+
)),
1271+
);
12701272

12711273
candidates
12721274
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,8 @@ OPTIONS
228228

229229
o Any supported target in rustc --print target-list.
230230

231-
o "host", which will internally be substituted by the host’s
232-
target. This can be particularly useful if you’re
231+
o "host-tuple", which will internally be substituted by the
232+
host’s target. This can be particularly useful if you’re
233233
cross-compiling some crates, and don’t want to specify your
234234
host’s machine as a target (for instance, an xtask in a shared
235235
project that may be worked on by many hosts).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ OPTIONS
145145

146146
o Any supported target in rustc --print target-list.
147147

148-
o "host", which will internally be substituted by the host’s
149-
target. This can be particularly useful if you’re
148+
o "host-tuple", which will internally be substituted by the
149+
host’s target. This can be particularly useful if you’re
150150
cross-compiling some crates, and don’t want to specify your
151151
host’s machine as a target (for instance, an xtask in a shared
152152
project that may be worked on by many hosts).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ OPTIONS
142142

143143
o Any supported target in rustc --print target-list.
144144

145-
o "host", which will internally be substituted by the host’s
146-
target. This can be particularly useful if you’re
145+
o "host-tuple", which will internally be substituted by the
146+
host’s target. This can be particularly useful if you’re
147147
cross-compiling some crates, and don’t want to specify your
148148
host’s machine as a target (for instance, an xtask in a shared
149149
project that may be worked on by many hosts).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ OPTIONS
5353

5454
o Any supported target in rustc --print target-list.
5555

56-
o "host", which will internally be substituted by the host’s
57-
target. This can be particularly useful if you’re
56+
o "host-tuple", which will internally be substituted by the
57+
host’s target. This can be particularly useful if you’re
5858
cross-compiling some crates, and don’t want to specify your
5959
host’s machine as a target (for instance, an xtask in a shared
6060
project that may be worked on by many hosts).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ OPTIONS
124124

125125
o Any supported target in rustc --print target-list.
126126

127-
o "host", which will internally be substituted by the host’s
128-
target. This can be particularly useful if you’re
127+
o "host-tuple", which will internally be substituted by the
128+
host’s target. This can be particularly useful if you’re
129129
cross-compiling some crates, and don’t want to specify your
130130
host’s machine as a target (for instance, an xtask in a shared
131131
project that may be worked on by many hosts).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ OPTIONS
3333

3434
o Any supported target in rustc --print target-list.
3535

36-
o "host", which will internally be substituted by the host’s
37-
target. This can be particularly useful if you’re
36+
o "host-tuple", which will internally be substituted by the
37+
host’s target. This can be particularly useful if you’re
3838
cross-compiling some crates, and don’t want to specify your
3939
host’s machine as a target (for instance, an xtask in a shared
4040
project that may be worked on by many hosts).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ OPTIONS
216216

217217
o Any supported target in rustc --print target-list.
218218

219-
o "host", which will internally be substituted by the host’s
220-
target. This can be particularly useful if you’re
219+
o "host-tuple", which will internally be substituted by the
220+
host’s target. This can be particularly useful if you’re
221221
cross-compiling some crates, and don’t want to specify your
222222
host’s machine as a target (for instance, an xtask in a shared
223223
project that may be worked on by many hosts).

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,8 @@ OPTIONS
194194

195195
o Any supported target in rustc --print target-list.
196196

197-
o "host", which will internally be substituted by the host’s
198-
target. This can be particularly useful if you’re
197+
o "host-tuple", which will internally be substituted by the
198+
host’s target. This can be particularly useful if you’re
199199
cross-compiling some crates, and don’t want to specify your
200200
host’s machine as a target (for instance, an xtask in a shared
201201
project that may be worked on by many hosts).

0 commit comments

Comments
 (0)