Closed
Description
Code
#[proc_macro_attribute]
pub fn attribute_macro(_metadata: TokenStream, input: TokenStream) -> TokenStream {
input
}
Current output
error: expected derive macro, found attribute macro `my_macro::attribute_macro`
|
1 | #[derive(my_macro::attribute_macro)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a derive macro
Desired output
(The actual desired output should have colours and minuses on the removed derive, but to give the idea)
error: expected derive macro, found attribute macro `my_macro::attribute_macro`
|
1 | #[derive(my_macro::attribute_macro)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^ not a derive macro
= help: remove the "derive":
#[my_macro::attribute_macro]
Rationale and extra context
Many users are not familiar with the terminology being used by the compiler error (i.e. the different flavours of procedural macro, derive vs attribute) and might be confused as to what they need to do in order to fix the error.
Since the fix is straight-forward (i.e. remove the derive
), the compiler should show a code snippet that fixes the issue.
Other cases
No response
Anything else?
No response