[nextest-runner] support "host-tuple" as a target triple#2872
Conversation
Recent Rust versions added `--target host-tuple` support, allowing users to explicitly do a cross-compile targeting the host platform. This change adds support for "host-tuple" as a special target string that resolves to the detected host platform. Closes #2858.
There was a problem hiding this comment.
Pull request overview
This PR adds support for "host-tuple" as a special target triple value that resolves to the host platform, matching recent Rust compiler functionality that allows --target host-tuple to explicitly cross-compile targeting the host platform.
Key Changes:
- Modified
TargetTriple::findand related methods to accept ahost_platformparameter used to resolve "host-tuple" - Added special case handling in
resolve_tripleto detect "host-tuple" and return the host platform - Updated all call sites to pass the host platform information
- Added comprehensive test coverage for "host-tuple" across all configuration sources (CLI, env var, config file)
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| nextest-runner/src/cargo_config/target_triple.rs | Core implementation: added host_platform parameter to find, from_env, from_cargo_configs, and resolve_triple methods; added "host-tuple" special case handling; added comprehensive tests |
| cargo-nextest/src/dispatch/helpers.rs | Updated detect_build_platforms and discover_target_triple to pass host platform to TargetTriple::find |
| nextest-runner/src/config/utils/test_helpers.rs | Updated test helper to create and pass dummy host platform to TargetTriple::find |
| nextest-runner/tests/integration/target_runner.rs | Updated integration test to pass host platform from detected host to TargetTriple::find |
| nextest-runner/tests/integration/target_triple.rs | Added dummy_host_platform helper and updated target_triple test function to pass host platform |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -96,10 +96,12 @@ impl TargetTriple { | |||
| /// 2. the CARGO_BUILD_TARGET env var | |||
| /// 3. build.target in Cargo config files | |||
| /// | |||
There was a problem hiding this comment.
The documentation for the find method should mention that "host-tuple" can be used as a special target triple value that resolves to the host platform. While line 99 mentions the host_platform parameter is used to resolve "host-tuple", it would be clearer to explicitly state in the method's main documentation (around line 91-98) that callers can pass "host-tuple" as a value for target_cli_option or set it in environment variables/config files.
| /// | |
| /// | |
| /// Any of these sources may specify the special target triple value `"host-tuple"`, which | |
| /// resolves to the host platform. | |
| /// |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2872 +/- ##
==========================================
+ Coverage 80.55% 80.63% +0.07%
==========================================
Files 115 115
Lines 27880 28008 +128
==========================================
+ Hits 22459 22584 +125
- Misses 5421 5424 +3 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Recent Rust versions added
--target host-tuplesupport, allowing users to explicitly do a cross-compile targeting the host platform. This change adds support for "host-tuple" as a special target string that resolves to the detected host platform.Closes #2858.