Expand diagnostic for attributes on macro calls#158106
Conversation
|
Some changes occurred in compiler/rustc_attr_parsing |
|
|
||
| #[derive(Subdiagnostic)] | ||
| pub(crate) enum OnMacroCall { | ||
| #[warning("this representation attribute is ignored")] |
There was a problem hiding this comment.
Why is the repr attribute special cased?
There was a problem hiding this comment.
It's a particular dangerous mistake because people assume that it acts on the macro expension. It is one of those things where you think you know what it does but are wrong.
There was a problem hiding this comment.
Hmmm I'm not sure I really like that special case, I think the extra warning message is not really helping the user understand it better, the note you added should be enough
| pub(crate) enum OnMacroCall { | ||
| #[warning("this representation attribute is ignored")] | ||
| #[note( | ||
| "attributes on macro invocations do nothing even if the macro expands to what would be a valid target for the attribute" |
There was a problem hiding this comment.
This is not true, the cfg and cfg_attr attribute do work, and I'm expecting proc macro attributes to also work but not sure.
Maybe change it to
"this attribute does nothing on macro invocations..."
There was a problem hiding this comment.
Right, I forgot about the active attributes.
|
Reminder, once the PR becomes ready for a review, use |
|
@bors r+ rollup |
Expand diagnostic for attributes on macro calls As far as I am aware there are no attributes that do something when used on macro invocations. r? @JonathanBrouwer
As far as I am aware there are no attributes that do something when used on macro invocations.
r? @JonathanBrouwer