Skip to content

disallow most attrs on eiis#157312

Open
jdonszelmann wants to merge 1 commit into
rust-lang:mainfrom
jdonszelmann:reject-attrs-eii
Open

disallow most attrs on eiis#157312
jdonszelmann wants to merge 1 commit into
rust-lang:mainfrom
jdonszelmann:reject-attrs-eii

Conversation

@jdonszelmann
Copy link
Copy Markdown
Contributor

@jdonszelmann jdonszelmann commented Jun 2, 2026

Most attributes do not make sense on EIIs. Whether they're copied to the macro, default, or foreign item is also highly dependent per attribute.

I was thinking of ways to configure this, though I don't think we need that kind of complexity rn. For now I just reject them all, except for ones that obviously make sense or are necessary for current usage in std.

user attr macros are blanket-rejected with this too, which seems good, it seems cursed to present expanded eiis to them.

r? @JonathanBrouwer

@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 Jun 2, 2026
}

#[derive(Diagnostic)]
#[diag("only a small subset of attributes are supported on externally implementable items")]
Copy link
Copy Markdown
Contributor

@JonathanBrouwer JonathanBrouwer Jun 2, 2026

Choose a reason for hiding this comment

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

Could we have a few tests for this? Both for attributes that are supported such as inline, and attributes that are not supported

View changes since the 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 2, 2026
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Jun 2, 2026

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

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

Labels

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