Skip to content

rustc: target_features: allow for cfg-only stable target_features#155962

Open
romancardenas wants to merge 1 commit intorust-lang:mainfrom
romancardenas:cfg-only-stable-target-feature
Open

rustc: target_features: allow for cfg-only stable target_features#155962
romancardenas wants to merge 1 commit intorust-lang:mainfrom
romancardenas:cfg-only-stable-target-feature

Conversation

@romancardenas
Copy link
Copy Markdown

@romancardenas romancardenas commented Apr 29, 2026

This PR introduces a new stabilization level for target_features: CfgOnlyStable. The motivation is allowing the Rust compiler to expose target_features of targets so users can use cfg(target_feature = "feature") for conditional blocks depending on target features. However, CfgOnlyStable cannot be used for #[target_feature(enable = "feature")], as this is still considered unstable. Accordingly, the compiler will still raise an error if these expressions are used on stable.

This PR relates partially to #150257. As discussed, for RISC-V targets, having the "d", "e", and "f" target features exposed will allow baremetal developers to adapt the code depending on the target's properties.

r? @RalfJung

@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 Apr 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 29, 2026

r? @nikomatsakis

rustbot has assigned @nikomatsakis.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 73 candidates
  • Random selection from 20 candidates

@rustbot rustbot assigned RalfJung and unassigned nikomatsakis Apr 29, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Apr 29, 2026

RalfJung is not on the review rotation at the moment.
They may take a while to respond.

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

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants