Skip to content

Check supported features per CodegenBackend - #164714

Open
TechnoPorg wants to merge 3 commits into
rust-lang:mainfrom
TechnoPorg:codegen-backend-supported-features
Open

TechnoPorg wants to merge 3 commits into
rust-lang:mainfrom
TechnoPorg:codegen-backend-supported-features

Conversation

@TechnoPorg

@TechnoPorg TechnoPorg commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Closes #164533

Of the possible designs discussed in that issue, this goes with the struct option rather than the CodegenBackend method option, as the former is easier to attach to Session, whereas the latter would require passing around the CodegenBackend.

There is a remarkable number of LLVM-specific compiler options that get ignored by other backends, and I'm not sure which of these, if any, we should attempt to validate with other backends.

This PR is a draft because I'm not familiar enough with the compiler yet to say what the best design is, and I think it's easier to iterate on it with actual code in front of us:

  • Should all the validation be done at once when creating the Session, rather than in its methods?
    • If yes, a method to check supported features might be better than the struct
  • As mentioned above, which features should be validated vs. ignored?

r? @ZuseZ4

cc @RalfJung, @antoyo, @GuillaumeGomez, @bjorn3 as participants on the issue thread.
@rustbot label C-cleanup T-compiler A-codegen

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. A-codegen Area: Code generation C-cleanup Category: PRs that clean code up or issues documenting cleanup. labels Oct 22, 2026
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the PG-exploit-mitigations Project group: Exploit mitigations label Oct 24, 2026
@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

Comment thread tests/ui/sanitizer/leak.rs Resolved
@TechnoPorg
TechnoPorg force-pushed the codegen-backend-supported-features branch from d911333 to 5a76d73 Compare October 28, 2026 23:42
@rustbot rustbot added A-compiletest Area: The compiletest test runner A-testsuite Area: The testsuite used to check the correctness of rustc T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Oct 28, 2026
@rust-log-analyzer

This comment has been minimized.

@TechnoPorg
TechnoPorg force-pushed the codegen-backend-supported-features branch 2 times, most recently from 7d42993 to 303edbe Compare October 29, 2026 12:40
@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Oct 29, 2026
@TechnoPorg
TechnoPorg force-pushed the codegen-backend-supported-features branch from 303edbe to d009976 Compare October 30, 2026 12:46
@rust-bors

This comment has been minimized.

@TechnoPorg
TechnoPorg force-pushed the codegen-backend-supported-features branch from d009976 to 06c8b9f Compare November 15, 2026 14:19
@rust-bors

This comment has been minimized.

@TechnoPorg
TechnoPorg force-pushed the codegen-backend-supported-features branch 2 times, most recently from b7a90aa to 7550093 Compare November 22, 2026 23:51
@TechnoPorg
TechnoPorg marked this pull request as ready for review November 22, 2026 23:52
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 22, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 22, 2026
@rustbot

rustbot commented Nov 22, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in src/tools/compiletest

cc @jieyouxu

rustc_codegen_gcc is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_gcc instead.

cc @antoyo, @GuillaumeGomez

Some changes occurred in tests/ui/sanitizer

cc @rcvalle

rustc_codegen_cranelift is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_cranelift instead.

cc @bjorn3

@TechnoPorg

Copy link
Copy Markdown
Contributor Author

In the absence of input on the design, I've made some changes to how the features are validated that feel reasonable to me :) @ZuseZ4 as we'd hoped, this simplifies the validation of codegen options when using TPDE.

@RalfJung would you like to see any/all of the other LLVM-specific codegen options moved into SupportedBackendFeatures?

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@TechnoPorg
TechnoPorg force-pushed the codegen-backend-supported-features branch from 7550093 to e628fd1 Compare November 23, 2026 12:57
@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-codegen Area: Code generation A-compiletest Area: The compiletest test runner A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc C-cleanup Category: PRs that clean code up or issues documenting cleanup. PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CodegenBackend method to check supported features

5 participants