-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Add target="host" meaning the current host #13051
Copy link
Copy link
Closed
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsA-cross-compilingArea: using --target flag for other platformsArea: using --target flag for other platformsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`E-easyExperience: EasyExperience: EasyS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewT-cargoTeam: CargoTeam: Cargodisposition-mergeFCP with intent to mergeFCP with intent to mergefinished-final-comment-periodFCP completeFCP completeto-announce
Metadata
Metadata
Assignees
Labels
A-configurationArea: cargo config files and env varsArea: cargo config files and env varsA-cross-compilingArea: using --target flag for other platformsArea: using --target flag for other platformsC-feature-requestCategory: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`E-easyExperience: EasyExperience: EasyS-acceptedStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewStatus: Issue or feature is accepted, and has a team member available to help mentor or reviewT-cargoTeam: CargoTeam: Cargodisposition-mergeFCP with intent to mergeFCP with intent to mergefinished-final-comment-periodFCP completeFCP completeto-announce
Type
Fields
Give feedbackNo fields configured for issues without a type.
Projects
StatusShow more project fields
FCP merge
Problem
Cargo defaults to compiling for the host's target triple, which is appropriate for most cases, particularly because this is the only (default) way to build tests that can be run. However, once the
targethas been overridden by configuration, there is no way to explicitly request on the command line that it be the host.Proposed Solution
Wherever a target triple is accepted, accept the special string
hostas an alias for the host platform's target triple.Notes
Use cases:
no_std, or is concerned with other platform limitations such as pointer width and atomics, could have an accompanying configuration file which automatically builds for the host, for testing, and another target, as a compatibility check; e.g.build.target = ["host", "thumbv7em-none-eabihf"].cargo test --target=hostto run some platform-independent tests in a package otherwise devoted to being cross-compiled (such that itsconfig.tomlhas atargetspecified to enable IDE support and better default behaviors).--target=hostwill not be identical to the behavior with no options specified, due to the behavior differences triggered by using--targetat all. This feature will introduce a way to trigger that intentionally without also needing to specify a particular target. This could be considered an alternative totarget-applies-to-host = false, but specifically does not introduce any new semantics that are not currently obtainable by--target=<whatever the host triple is>.Summary Notes
Managed by
@rustbot—see help for details