Closed
Description
Reported by @Hoverbear here: https://twitter.com/a_hoverbear/status/1428763621572501507
use serde::{Deserialize, Serialize};
#[derive(Serialize)]
struct A;
Output:
error: cannot find derive macro `Serialize` in this scope
--> src/main.rs:3:10
|
3 | #[derive(Serialize)]
| ^^^^^^^^^
warning: unused import: `serde::Serialize`
--> src/main.rs:1:5
|
1 | use serde::Serialize;
| ^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
The diagnostics shows that Serialize
is not found, and then complains that Serialize
was imported and unused. Confusing.
(Only the trait Serialize
is imported, not the Serialize
derive macro, as the derive
feature wasn't enabled on serde
.)