fix: dont apply host-config gating to stable behavior#17198
Conversation
Captured behaviors are likely bugs introduced by rust-lang#17123 See also rust-lang/miri#5101
|
r? @ehuss rustbot has assigned @ehuss. Use Why was this reviewer chosen?The reviewer was selected based on:
|
|
This means we'll have to revert rust-lang/miri@afd5aff in Miri, so please let me know when this lands in the main repo. Maybe we can even include the revert of that commit in the PR that syncs this update to rust-lang/rust? What is the intended behavior of
|
| .masquerade_as_nightly_cargo(&["target-applies-to-host", "host-config"]) | ||
| .with_stderr_data(str![[r#" | ||
| ... | ||
| [RUNNING] `[ROOT]/foo/target/debug/deps/foo-[HASH][EXE]` |
There was a problem hiding this comment.
Am I misunderstanding this test, or does this not use any of the runners? That seems very strange?
There was a problem hiding this comment.
No, your are not. This is likely a bug.
What is the intended behavior of target.runner wrt proc macro tests in various flag configurations after this PR?
Some purposes of this PR are
- to revert some stable behavior back to whatever 1.97 has, in order to give us a room to breath and discuss the intended behavior
- to capture the current state of the interaction around proc macro (tests)
See the counterpart PR against 1.97 that has the same issue https://github.com/weihanglo/cargo/pull/92/changes.
I am sorry about the whole mess. Will try to follow up with a new Cargo issue.
There was a problem hiding this comment.
Some purposes of this PR are
That makes sense to me, thanks.
There was a problem hiding this comment.
Opened #17200.
This means we'll have to revert rust-lang/miri@afd5aff in Miri, so please let me know when this lands in the main repo. Maybe we can even include the revert of that commit in the PR that syncs this update to rust-lang/rust?
Regarding this, I think we will backport this to 1.98-beta. Will kindly ask for your help to also revert that in beta when Cargo's beta backport PR merges. I am willing to do the Cargo submodule/ Miri subtree sync for both beta and nightly 🙇🏾♂️
There was a problem hiding this comment.
Miri is nightly-only so beta backports don't affect us.
rust-lang#17123 made host artifacts stop picking up `target.'cfg(..)'.runner` and `target.'cfg(..)'.linker` even without `-Ztarget-applies-to-host -Zhost-config`. That silently changed stable behavior that `target.'cfg(..)'` no longer applied to proc-macro and build script compilation under `--target <host>`, while `target.<triple>` config still did. The old gate reused `host_artifact_uses_only_host_config`, which is for the documented rustflags dual behavior. It wasn't for runner and linker. This PR narrows the gate to `target-applies-to-host = false` and restore to pre PR 17123 stable behavior, while keeping `-Zhost-config` fix as it is still nightly.
Beta backports - #17198 In order to make CI pass, the following PRs are also cherry-picked: -
Update cargo submodule 29 commits in 59800466c5c41c444d264b1010b4d57e85a7117f..3efb1f477e99b42974b982d939fd100303cdf7db 2026-07-07 15:52:22 +0000 to 2026-07-17 23:53:19 +0000 - refactor(context): normalize in `homedir` instead (rust-lang/cargo#17222) - chore(ci): reflect doc folder move in book deployment (rust-lang/cargo#17235) - refactor(ops): Have cargo-metadata's ops match the command name (rust-lang/cargo#17233) - chore: Flatten src (rust-lang/cargo#17231) - chore: Flatten `src` (rust-lang/cargo#17230) - chore(ci): remove stale libsecret packages (rust-lang/cargo#17229) - perf: Lazily initialize git2 fetch transports (rust-lang/cargo#17226) - test(trim-paths): re-enable lldb debugger tests (rust-lang/cargo#17223) - Include SBOM outputs in fingerprints (rust-lang/cargo#17216) - Update cfg_aliases to 0.2.2 (rust-lang/cargo#17225) - test(trim-paths): exercise GDB on windows-gnu (rust-lang/cargo#17221) - feat(profile): Disable incremental compilation under CI by default (rust-lang/cargo#17220) - Remove myself from review rotation (rust-lang/cargo#17219) - Fix typo in comment in sync (rust-lang/cargo#17217) - docs(ref): Improve handing of built-in profiles (rust-lang/cargo#17213) - fix: dont apply host-config gating to stable behavior (rust-lang/cargo#17198) - chore(deps): update msrv (rust-lang/cargo#17192) - test: fix race in cargo_compile_with_invalid_code_in_deps (rust-lang/cargo#17203) - Rename `-Zno-embed-metadata` to `-Zembed-metadata=no` (rust-lang/cargo#17149) - fix(source): incorrect duplicate package warning (rust-lang/cargo#17204) - Fix manifest schema generation: `TomlDebugInfo` enum-variants doesn't renamed (rust-lang/cargo#17202) - Reduce library search path length in new build dir layout (rust-lang/cargo#17191) - fix(install): Move --debug to Compilation options (rust-lang/cargo#17199) - chore(ci): dogfood `build.warnings` (rust-lang/cargo#17195) - docs(lints): Better match clippy in lint section titles (rust-lang/cargo#17190) - chore: bump to 0.100.0; update changelog (rust-lang/cargo#17189) - docs(ref): Clarify MSRV for lints (rust-lang/cargo#17184) - docs(report): add missing entry for `cargo report future-incompatibilities` (rust-lang/cargo#17188) - Reduce rustc `-L` args used in the new `build-dir` layout (rust-lang/cargo#17168)
Update cargo submodule 29 commits in 59800466c5c41c444d264b1010b4d57e85a7117f..3efb1f477e99b42974b982d939fd100303cdf7db 2026-07-07 15:52:22 +0000 to 2026-07-17 23:53:19 +0000 - refactor(context): normalize in `homedir` instead (rust-lang/cargo#17222) - chore(ci): reflect doc folder move in book deployment (rust-lang/cargo#17235) - refactor(ops): Have cargo-metadata's ops match the command name (rust-lang/cargo#17233) - chore: Flatten src (rust-lang/cargo#17231) - chore: Flatten `src` (rust-lang/cargo#17230) - chore(ci): remove stale libsecret packages (rust-lang/cargo#17229) - perf: Lazily initialize git2 fetch transports (rust-lang/cargo#17226) - test(trim-paths): re-enable lldb debugger tests (rust-lang/cargo#17223) - Include SBOM outputs in fingerprints (rust-lang/cargo#17216) - Update cfg_aliases to 0.2.2 (rust-lang/cargo#17225) - test(trim-paths): exercise GDB on windows-gnu (rust-lang/cargo#17221) - feat(profile): Disable incremental compilation under CI by default (rust-lang/cargo#17220) - Remove myself from review rotation (rust-lang/cargo#17219) - Fix typo in comment in sync (rust-lang/cargo#17217) - docs(ref): Improve handing of built-in profiles (rust-lang/cargo#17213) - fix: dont apply host-config gating to stable behavior (rust-lang/cargo#17198) - chore(deps): update msrv (rust-lang/cargo#17192) - test: fix race in cargo_compile_with_invalid_code_in_deps (rust-lang/cargo#17203) - Rename `-Zno-embed-metadata` to `-Zembed-metadata=no` (rust-lang/cargo#17149) - fix(source): incorrect duplicate package warning (rust-lang/cargo#17204) - Fix manifest schema generation: `TomlDebugInfo` enum-variants doesn't renamed (rust-lang/cargo#17202) - Reduce library search path length in new build dir layout (rust-lang/cargo#17191) - fix(install): Move --debug to Compilation options (rust-lang/cargo#17199) - chore(ci): dogfood `build.warnings` (rust-lang/cargo#17195) - docs(lints): Better match clippy in lint section titles (rust-lang/cargo#17190) - chore: bump to 0.100.0; update changelog (rust-lang/cargo#17189) - docs(ref): Clarify MSRV for lints (rust-lang/cargo#17184) - docs(report): add missing entry for `cargo report future-incompatibilities` (rust-lang/cargo#17188) - Reduce rustc `-L` args used in the new `build-dir` layout (rust-lang/cargo#17168)
What does this PR try to resolve?
Related: #17200
#17123 made host artifacts stop picking up
target.cfg(…).runnerandtarget.cfg(…).linkereven without
-Zhost-config.That silently changed stable behavior that
target.cfgno longer applied to proc-macroand build script compilation under
--target <host>,while
target.<triple>config still did.The old gate reused
host_artifact_uses_only_host_config,which is for the documented rustflags dual behavior.
It wasn't for runner and linker.
This PR narrows the gate to
target-applies-to-host = falseand restore to pre-#17123 stable behavior,
while keeping
-Zhost-configfix as it is still nightly.How to test and review this PR?
I've added a lot of tests because I don't want to miss any edge cases again.
Here is the change table.
custom_runner_cfg_proc_macro_test_with_targettarget_cfg_linker_build_script_with_targettarget_cfg_linker_proc_macro_with_targettarget_cfg_linker_proc_macro_test_with_targettarget_cfg_runner_build_script_with_host_config_and_targettarget_cfg_linker_build_script_with_host_config_and_targetAll other added tests behave identically across 1.97, 1.98-beta, and this PR.
See #17200 for the runner/linker inconsistency they document.
Note
We'll need to backport this to 1.98-beta once it lands.