Closed
Description
On [email protected], given this input struct from one of darling
's examples:
#[derive(FromDeriveInput)]
#[darling(attributes(lorem))]
struct LoremReceiver<#[darling(bound = "::darling::FromGenericParam")] T> {
generics: ast::Generics<ast::GenericParam<T>>,
}
The compiler produces the following error when trying to run the example:
error[E0658]: The attribute `darling` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> examples/generics.rs:10:10
|
10 | #[derive(FromDeriveInput)]
| ^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable
error: aborting due to previous error
For more information about this error, try `rustc --explain E0658`.
error: Could not compile `darling`.
Adding the attribute and running cargo expand
produces:
#[darling(attributes(lorem))]
struct LoremReceiver<#[darling(bound = "::darling::FromGenericParam")] T> {
generics: ast::Generics<ast::GenericParam<T>>,
}
impl<#[darling(bound = "::darling::FromGenericParam")] T: ::darling::FromGenericParam> ::darling::FromDeriveInput for LoremReceiver<T> {
fn from_derive_input(__di: &::syn::DeriveInput) -> ::darling::Result<Self> {
// ... remainder elided
}
}
The compiler appears to be complaining about the attribute in the ImplGeneric
position; I've modified my code to strip all attributes from GenericParam
before calling split_for_impl
and it works fine without the feature
flag. This theory is corroborated by rust-lang/rust#48848, which doesn't mention allowing attributes in this position.
I think the fix is as simple as removing this line, though there might be legitimate uses of this I don't know about, maybe?
Metadata
Metadata
Assignees
Labels
No labels