Open
Description
#[macro_use]
extern crate serde_derive;
#[serde(untagged)]
enum CellIndex {
Auto,
Index(u32),
}
error[E0658]: The attribute `serde` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> src/main.rs:4:1
|
4 | #[serde(untagged)]
| ^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable
The error and suggestion are super misleading and I have seen this a few times in #serde. It should be possible for the compiler to observe that there are derive macros in scope with serde
declared as an attribute, and suggest using those.
// These are in scope
#[proc_macro_derive(Serialize, attributes(serde))]
#[proc_macro_derive(Deserialize, attributes(serde))]
A better message would not have the part about the compiler adding meaning to #[serde]
in the future and would recommend using #[derive(Serialize)]
or #[derive(Deserialize)]
on the struct containing the attribute.
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: All kinds of macros (custom derive, macro_rules!, proc macros, ..)Area: Procedural macrosCategory: An issue proposing an enhancement or a PR with one.Diagnostics: Confusing error or lint; hard to understand for new users.Relevant to the compiler team, which will review and decide on the PR/issue.