Skip to content

Fix feature gate for repr(simd)#158523

Open
JonathanBrouwer wants to merge 1 commit into
rust-lang:mainfrom
JonathanBrouwer:repr_simd
Open

Fix feature gate for repr(simd)#158523
JonathanBrouwer wants to merge 1 commit into
rust-lang:mainfrom
JonathanBrouwer:repr_simd

Conversation

@JonathanBrouwer

@JonathanBrouwer JonathanBrouwer commented Jun 28, 2026

Copy link
Copy Markdown
Contributor

The following code currently compiles on stable rust:

#[repr(simd)]
println!()

This has the following behavior:

  • 1.90 and earlier give an "unused attribute warning"
  • 1.91 ..= beta give no diagnostic output
  • nightly gives the following:
warning: `#[repr(simd)]` attribute cannot be used on macro calls
 --> src/main.rs:4:5
  |
4 |     #[repr(simd)]
  |     ^^^^^^^^^^^^^
  |
  = help: `#[repr(simd)]` can only be applied to structs
  = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
  = note: `#[warn(unused_attributes)]` (part of `#[warn(unused)]`) on by default

This PR changes this to a feature gate error.
r? @mejrs

@JonathanBrouwer JonathanBrouwer added needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. I-lang-nominated Nominated for discussion during a lang team meeting. S-waiting-on-t-lang Status: Awaiting decision from T-lang labels Jun 28, 2026
@rustbot

rustbot commented Jun 28, 2026

Copy link
Copy Markdown
Collaborator

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@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 28, 2026
@JonathanBrouwer JonathanBrouwer added the I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination label Jun 28, 2026

@mejrs mejrs 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.

Please amend the PR description to state that this compiles without warning on rust 1.91 ..= current beta; this warning is only shown on nightly.

View changes since this review

Comment thread compiler/rustc_attr_parsing/src/attributes/repr.rs Outdated
@mejrs mejrs 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 28, 2026
@JonathanBrouwer

Copy link
Copy Markdown
Contributor Author

@rustbot ready

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

@mejrs mejrs 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.

r=me after lang decision

View changes since this review

@mejrs mejrs removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 29, 2026
@traviscross traviscross added P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang T-lang Relevant to the language team labels Jul 1, 2026
@traviscross

Copy link
Copy Markdown
Contributor

Makes sense to me. Thanks for cleaning this up.

@rfcbot fcp merge lang

@rust-rfcbot

rust-rfcbot commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

@traviscross has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

cc @rust-lang/lang-advisors: FCP proposed for lang, please feel free to register concerns.
See this document for info about what commands tagged team members can give me.

@rust-rfcbot rust-rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. and removed needs-fcp This change is insta-stable, or significant enough to need a team FCP to proceed. labels Jul 1, 2026
@tmandry

tmandry commented Jul 1, 2026

Copy link
Copy Markdown
Member

@rfcbot reviewed

@rust-rfcbot rust-rfcbot added final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Jul 1, 2026
@rust-rfcbot

Copy link
Copy Markdown
Collaborator

🔔 This is now entering its final comment period, as per the review above. 🔔

@nikomatsakis

Copy link
Copy Markdown
Contributor

@rfcbot reviewed

@traviscross traviscross added I-lang-radar Items that are on lang's radar and will need eventual work or consideration. and removed I-lang-nominated Nominated for discussion during a lang team meeting. I-lang-easy-decision Issue: The decision needed by the team is conjectured to be easy; this does not imply nomination P-lang-drag-1 Lang team prioritization drag level 1. https://rust-lang.zulipchat.com/#narrow/channel/410516-t-lang labels Jul 1, 2026
@joshtriplett

Copy link
Copy Markdown
Member

Took a moment to realize that this is both no longer allowing repr(simd) on a macro call and moving the feature gate logic (which is also why the test output gets reordered).

Looks fine, though.

@scottmcm

scottmcm commented Jul 1, 2026

Copy link
Copy Markdown
Member

I was pondering whether this is clearly a bug and thus we should just skip the 10-day wait since the branch is Friday(?). Mark pointed out that it's already on stable, though, so if it waits another release it's no big deal.

@mejrs

mejrs commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Took a moment to realize that this is both no longer allowing repr(simd) on a macro call and moving the feature gate logic

We do currently allow the other repr variants on macro calls

#[repr(C)] 
println!();

with the same "1.91 ..= beta give no diagnostic output" problem.

I'm currently running crater on that (#158816), any breakage from this PR should also show up in it.

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. I-lang-radar Items that are on lang's radar and will need eventual work or consideration. S-waiting-on-t-lang Status: Awaiting decision from T-lang T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-lang Relevant to the language team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants