-
Notifications
You must be signed in to change notification settings - Fork 13.5k
Attribute rework: a parser for single attributes without arguments #142964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We're gonna have a lot of these, seems like a good change to me
Should I try to include a65ea33 into this PR too? |
☔ The latest upstream changes (presumably #142997) made this pull request unmergeable. Please resolve the merge conflicts. |
3c71263
to
b350089
Compare
☔ The latest upstream changes (presumably #143173) made this pull request unmergeable. Please resolve the merge conflicts. |
b350089
to
77d08ac
Compare
☔ The latest upstream changes (presumably #143233) made this pull request unmergeable. Please resolve the merge conflicts. |
77d08ac
to
187babc
Compare
|
||
impl<T: NoArgsAttributeParser<S>, S: Stage> SingleAttributeParser<S> for WithoutArgs<T, S> { | ||
const PATH: &[Symbol] = T::PATH; | ||
const ATTRIBUTE_ORDER: AttributeOrder = AttributeOrder::KeepLast; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is KeepLast acceptable here? Are there no single attributes which have KeepFirst?
I think my personal preference would be having only the macro and not the extra trait (the macro generating a Jana is on holidays so r? @oli-obk |
Part of #131229
r? @jdonszelmann
I think code (with comments) speaks for itself.
The only subtlety: now
#[cold]
,#[no_mangle]
, &#[track_caller]
do not get thrown away when malformed (i.e. have arguments). This doesn't matter too much (I think), because an error gets emitted either way, so the compilation will not finish.