-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rustc_target: Move some target options from Target
to TargetOptions
#77729
Conversation
r? @estebank (rust_highfive has picked a reviewer for you, use r? to override) |
This comment has been minimized.
This comment has been minimized.
881a401
to
7f49798
Compare
This comment has been minimized.
This comment has been minimized.
7f49798
to
05084ab
Compare
ping @estebank, it's been 3 weeks. |
r? @Mark-Simulacrum, by GitHub suggestion. |
@bors r+ rollup=never -- I did a lookthrough and didn't spot any obvious mistakes, but of course with such large mechanical diffs I may have missed something. I'm not too worried though, in practice it seems like for tier 1 platforms we'll catch it quickly (perhaps even in CI) if there were accidental typos or whatever. |
📌 Commit 05084ab85537332a0e36853fb8487bd0c9f7e386 has been approved by |
⌛ Testing commit 05084ab85537332a0e36853fb8487bd0c9f7e386 with merge 4ac1d90f32b90b154035fa4f93e22c5627bc87b4... |
💔 Test failed - checks-actions |
This needs a rebase, new targets were added. |
05084ab
to
c0c0597
Compare
@bors r=Mark-Simulacrum |
📌 Commit c0c0597 has been approved by |
☀️ Test successful - checks-actions |
rustc_target: Further cleanup use of target options Follow up to rust-lang/rust#77729. Implements items 2 and 4 from the list in rust-lang/rust#77729 (comment). The first commit collapses uses of `target.options.foo` into `target.foo`. The second commit renames some target options to avoid tautology: `target.target_endian` -> `target.endian` `target.target_c_int_width` -> `target.c_int_width` `target.target_os` -> `target.os` `target.target_env` -> `target.env` `target.target_vendor` -> `target.vendor` `target.target_family` -> `target.os_family` `target.target_mcount` -> `target.mcount` r? `@Mark-Simulacrum`
Android is not GNU For a long time, the Android targets had `target_env=""`, but this changed to `"gnu"` in Rust 1.49.0. I tracked this down to rust-lang#77729 which started setting `"gnu"` in the `linux_base` target options, and this was inherited by `android_base`. Then rust-lang#78929 split the env into `linux_gnu_base`, but `android_base` was also changed to follow that. Android was not specifically mentioned in either pull request, so I believe this was an accident. Moving it back to `linux_base` will use an empty `env` again. r? `@Mark-Simulacrum` cc `@petrochenkov`
Android is not GNU For a long time, the Android targets had `target_env=""`, but this changed to `"gnu"` in Rust 1.49.0. I tracked this down to rust-lang#77729 which started setting `"gnu"` in the `linux_base` target options, and this was inherited by `android_base`. Then rust-lang#78929 split the env into `linux_gnu_base`, but `android_base` was also changed to follow that. Android was not specifically mentioned in either pull request, so I believe this was an accident. Moving it back to `linux_base` will use an empty `env` again. r? ``@Mark-Simulacrum`` cc ``@petrochenkov``
Android is not GNU For a long time, the Android targets had `target_env=""`, but this changed to `"gnu"` in Rust 1.49.0. I tracked this down to rust-lang#77729 which started setting `"gnu"` in the `linux_base` target options, and this was inherited by `android_base`. Then rust-lang#78929 split the env into `linux_gnu_base`, but `android_base` was also changed to follow that. Android was not specifically mentioned in either pull request, so I believe this was an accident. Moving it back to `linux_base` will use an empty `env` again. r? ```@Mark-Simulacrum``` cc ```@petrochenkov```
Android is not GNU For a long time, the Android targets had `target_env=""`, but this changed to `"gnu"` in Rust 1.49.0. I tracked this down to rust-lang#77729 which started setting `"gnu"` in the `linux_base` target options, and this was inherited by `android_base`. Then rust-lang#78929 split the env into `linux_gnu_base`, but `android_base` was also changed to follow that. Android was not specifically mentioned in either pull request, so I believe this was an accident. Moving it back to `linux_base` will use an empty `env` again. r? ````@Mark-Simulacrum```` cc ````@petrochenkov````
The only reason for
Target
toTargetOptions
to be separate structures is that options inTargetOptions
have reasonable defaults and options inTarget
don't.(Otherwise all the options logically belong to a single
Target
struct.)This PR moves a number of options with reasonable defaults from
Target
toTargetOptions
, so they no longer needs to be specified explicitly for majority of the targets.The move also allows to inherit the options from
rustc_target/src/spec/*_base.rs
files in a nicer way.I didn't change any specific option values here.
The moved options are
target_c_int_width
(defaults to"32"
),target_endian
(defaults to"little"
),target_os
(defaults to"none"
),target_env
(defaults to""
),target_vendor
(defaults to"unknown"
) andlinker_flavor
(defaults toLinkerFlavor::Gcc
).Next steps (in later PRs):
TargetOptions
intoTarget
If not, always accessDone in rustc_target: Further cleanup use of target options #78875.TargetOptions
fields throughDeref
making it a part ofTarget
at least logically (session.target.target.options.foo
->session.target.target.foo
)EliminateDone in No more target.target #77943.session::config::Config
and useTarget
instead (session.target.target.foo
->session.target.foo
)Avoid tautologies in option names (Done in rustc_target: Further cleanup use of target options #78875.target.target_os
->target.os
)Resolve _ rustc_target: The differences betweenDone in rustc_target: Change os and vendor values to "none" and "unknown" for some targets #78951.target_os = "none"
andtarget_os = "unknown"
, andtarget_vendor = "unknown"
andtarget_vendor = ""
are unclear #77730 (rustc_target: The differences betweentarget_os = "none"
andtarget_os = "unknown"
, andtarget_vendor = "unknown"
andtarget_vendor = ""
are unclear) noticed during implementation of this PR.