Remove target_override by nnethercote · Pull Request #122810 · rust-lang/rust (original) (raw)

nnethercote

Because the "target can override the backend" and "backend can override the target" situation is a mess. Details in the individual commits.

r? @WaffleLapkin

@nnethercote

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.

@nnethercote

Because the underlying type is called Target. (There is also a separate type called TargetCfg.)

@rustbot rustbot added S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

T-compiler

Relevant to the compiler team, which will review and decide on the PR/issue.

labels

Mar 21, 2024

@rustbot

WaffleLapkin

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@WaffleLapkin

@bors

📌 Commit 5744be2 has been approved by WaffleLapkin

It is now in the queue for this repository.

@bors 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

Mar 21, 2024

bors added a commit to rust-lang-ci/rust that referenced this pull request

Mar 21, 2024

@bors

…iaskrgr

Rollup of 8 pull requests

Successful merges:

r? @ghost @rustbot modify labels: rollup

rust-timer added a commit to rust-lang-ci/rust that referenced this pull request

Mar 21, 2024

@rust-timer

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 eddyb mentioned this pull request

Aug 3, 2024