You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
causing this error: cannot find attribute 'some_helper_attribute' in this scope
This becomes a problem when #[derive(Serialize)] is used together with other derive macros which use helper attributes on generic parameters.
In the example above, #[some_helper_attribute] is a helper attribute of the derive macro OtherMacro.
These helper attributes are preserved by serde, and copied into the impl block. There, they are outside of the context of the derive macro OtherMacro, and cause a "cannot find attribute .. in this scope" error.
The text was updated successfully, but these errors were encountered:
When the derive macros generate the
impl Serialize
andimpl Deserialize
, all attributes on generic parameters are preserved.Example:
results in
causing this error:
cannot find attribute 'some_helper_attribute' in this scope
This becomes a problem when
#[derive(Serialize)]
is used together with other derive macros which use helper attributes on generic parameters.In the example above,
#[some_helper_attribute]
is a helper attribute of the derive macroOtherMacro
.These helper attributes are preserved by serde, and copied into the
impl
block. There, they are outside of the context of the derive macroOtherMacro
, and cause a "cannot find attribute .. in this scope" error.The text was updated successfully, but these errors were encountered: