Skip to content

Move check_target_feature into the attribute parser#158313

Open
obeis wants to merge 1 commit into
rust-lang:mainfrom
obeis:move-check_target_feature
Open

Move check_target_feature into the attribute parser#158313
obeis wants to merge 1 commit into
rust-lang:mainfrom
obeis:move-check_target_feature

Conversation

@obeis

@obeis obeis commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Updates #153101

Use TargetFeatureParser to reject #[target_feature] on functions marked as lang items (via #[lang = "..."] or #[panic_handler]), replacing check_target_feature in rustc_passes.

r? @JonathanBrouwer

@rustbot

rustbot commented Jun 23, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) 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 Jun 23, 2026
Use `TargetFeatureParser` to reject `#[target_feature]` on functions
marked as lang items (via `#[lang = "..."]` or `#[panic_handler]`),
replacing `check_target_feature` in `rustc_passes`.
@obeis obeis force-pushed the move-check_target_feature branch from 9881ee7 to 284b9e1 Compare June 24, 2026 14:54
@rust-bors

rust-bors Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #158342) made this pull request unmergeable. Please resolve the merge conflicts by rebasing.

@JonathanBrouwer JonathanBrouwer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could you make the same change here as in #158361?

View changes since this review

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 26, 2026
@rustbot

rustbot commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

// except on WASM where calling target-feature functions is safe (see #84988).
if matches!(
cx.target,
Target::Fn | Target::Method(MethodKind::Trait { body: true } | MethodKind::Inherent)

@JonathanBrouwer JonathanBrouwer Jun 26, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder why we need to check the target here. Is there any test that fails if you remove this condition, if so, could you add a comment in the code with the reason this check is needed?

View changes since the review

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants