Skip to content

Commit 4994b5f

Browse files
committed
Document target-applies-to-host and fixup host-config docs.
1 parent 222f6ea commit 4994b5f

File tree

1 file changed

+27
-6
lines changed

1 file changed

+27
-6
lines changed

src/doc/src/reference/unstable.md

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,27 @@ cargo +nightly -Zunstable-options -Zconfig-include --config somefile.toml build
641641

642642
CLI paths are relative to the current working directory.
643643

644+
### target-applies-to-host
645+
* Original Pull Request: [#9322](https://github.com/rust-lang/cargo/pull/9322)
646+
647+
The `target-applies-to-host` key in a config file can be used set the desired
648+
behavior for passing target config flags to build scripts.
649+
650+
It requires the `-Ztarget-applies-to-host` command-line option.
651+
652+
The current default for `target-applies-to-host` is `true`, which will be
653+
changed to `false` in the future, if `-Zhost-config` is used the new `false`
654+
default will be set for `target-applies-to-host`.
655+
656+
```toml
657+
# config.toml
658+
target-applies-to-host = false
659+
```
660+
661+
```console
662+
cargo +nightly -Ztarget-applies-to-host build --target x86_64-unknown-linux-gnu
663+
```
664+
644665
### host-config
645666
* Original Pull Request: [#9322](https://github.com/rust-lang/cargo/pull/9322)
646667
* Tracking Issue: [#3349](https://github.com/rust-lang/cargo/issues/3349)
@@ -650,12 +671,11 @@ such as build scripts that must run on the host system instead of the target
650671
system when cross compiling. It supports both generic and host arch specific
651672
tables. Matching host arch tables take precedence over generic host tables.
652673

653-
It requires the `-Zhost-config` command-line option.
674+
It requires the `-Zhost-config` and `-Ztarget-applies-to-host` command-line
675+
options to be set.
654676

655677
```toml
656-
# .cargo/config
657-
cargo-features = ["host-config"]
658-
678+
# config.toml
659679
[host]
660680
linker = "/path/to/host/linker"
661681
[host.x86_64-unknown-linux-gnu]
@@ -668,10 +688,11 @@ The generic `host` table above will be entirely ignored when building on a
668688
`x86_64-unknown-linux-gnu` host as the `host.x86_64-unknown-linux-gnu` table
669689
takes precedence.
670690

671-
This feature requires a `--target` to be specified.
691+
Setting `-Zhost-config` changes the default for `target-applies-to-host` to
692+
`false` from `true`.
672693

673694
```console
674-
cargo +nightly -Zunstable-options -Zhost-config --config somefile.toml build --target x86_64-unknown-linux-gnu
695+
cargo +nightly -Ztarget-applies-to-host -Zhost-config build --target x86_64-unknown-linux-gnu
675696
```
676697

677698
### unit-graph

0 commit comments

Comments
 (0)