-
Notifications
You must be signed in to change notification settings - Fork 13.8k
Open
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I've got the following custom derive impl:
#[proc_macro_derive(ZeroFrom, attributes(zerofrom))]
pub fn zf_derive(input: TokenStream) -> TokenStream {
// ...
}
We already have code where #[zerofrom(clone)]
works on fields just fine.
However, the following does not work:
#[derive(zerofrom::ZeroFrom)]
pub struct FormatWidthsV1<#[zerofrom(may_borrow)] SymbolsV1> {
pub abbreviated: SymbolsV1,
// ...
}
which throws up the following error:
error: cannot find attribute `zerofrom` in this scope
--> components/datetime/src/provider/calendar/symbols.rs:147:29
|
147 | pub struct FormatWidthsV1<#[zerofrom(may_borrow)] SymbolsV1> {
| ^^^^^^^^
|
It seems like the attributes only get checked on fields and the struct itself, but this is deep in resolver code that I don't understand.
zjijz
Metadata
Metadata
Assignees
Labels
A-macrosArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: All kinds of macros (custom derive, macro_rules!, proc macros, ..)A-proc-macrosArea: Procedural macrosArea: Procedural macrosC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.