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
error[E0658]: the attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future
--> src/main.rs:12:5
|
12 | #[serde(rename = "request" )]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
error[E0658]: the attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future
--> src/main.rs:14:5
|
14 | #[serde(rename = "response" )]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: for more information, see https://github.com/rust-lang/rust/issues/29642
warning: unused import: `std::str::FromStr`
--> src/main.rs:5:5
|
5 | use std::str::FromStr;
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0658`.
Additional info
The program compiles successfully if the lines #[serde(rename = "response" )] are removed.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this issue, and sorry for the delay. The problem is that the newly created Discriminants enum doesn't implement Serialize so the compiler doesn't know what serde means in the context of the new type. EnumDiscriminants copies the attributes on each of the variants over to the new enum type, but it doesn't copy the derives over from the original type.
The current solution is to add a strum_discriminants attribute to the original enum and include
additional traits to derive. Here's and example that implements strum::EnumIter on the discriminant enum. Github Link
In this particular case, it would look something like:
Heya, I've opened #82 which is one way to resolve this. Hopefully the whitelist is sensible -- I've been using it for a number of projects and haven't run into any weird problems.
Hi!
I've noticed that using strum's derive
EnumDiscriminants
with some serde variant attributes, results in a compiler error.I'm not sure of this is an issue in strum, in serde, or both.
Here's a program to reproduce the issue:
Cargo.toml
src/main.rs
Compiler error
Additional info
The program compiles successfully if the lines
#[serde(rename = "response" )]
are removed.The text was updated successfully, but these errors were encountered: