Remove target_override
by nnethercote · Pull Request #122810 · rust-lang/rust (original) (raw)
Because the "target can override the backend" and "backend can override the target" situation is a mess. Details in the individual commits.
Backend and target selection is a mess: the target can override the
backend (via Target::default_codegen_backend
), and the backend can
override the target (via CodegenBackend::target_override
).
The code that handles this is ugly. It calls build_target_config
twice, once before getting the backend and once again afterward. It also
must check that both overrides aren't triggering at the same time.
This commit removes the latter override. It's used in rust-gpu but @eddyb said via Zulip that removing it would be ok. This simplifies the code greatly, and will allow some nice follow-up refactorings.
Because the underlying type is called Target
. (There is also a
separate type called TargetCfg
.)
rustbot added S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
Relevant to the compiler team, which will review and decide on the PR/issue.
labels
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
📌 Commit 5744be2 has been approved by WaffleLapkin
It is now in the queue for this repository.
bors added S-waiting-on-bors
Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
and removed S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
labels
bors added a commit to rust-lang-ci/rust that referenced this pull request
…iaskrgr
Rollup of 8 pull requests
Successful merges:
- rust-lang#122402 (Make
#[diagnostic::on_unimplemented]
format string parsing more robust) - rust-lang#122644 (pattern analysis: add a custom test harness)
- rust-lang#122733 (Strip placeholders from hidden types before remapping generic parameter)
- rust-lang#122752 (Interpolated cleanups)
- rust-lang#122771 (add some comments to hir::ModuleItems)
- rust-lang#122793 (Implement macro-based deref!() syntax for deref patterns)
- rust-lang#122810 (Remove
target_override
) - rust-lang#122827 (Remove unnecessary braces from
bug
/span_bug
)
r? @ghost
@rustbot
modify labels: rollup
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request
Rollup merge of rust-lang#122810 - nnethercote:rm-target_override, r=WaffleLapkin
Remove target_override
Because the "target can override the backend" and "backend can override the target" situation is a mess. Details in the individual commits.
r? @WaffleLapkin
eddyb mentioned this pull request