-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
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
.)
Hoverbear
Metadata
Metadata
Assignees
Labels
A-suggestion-diagnosticsArea: Suggestions generated by the compiler applied by `cargo fix`Area: Suggestions generated by the compiler applied by `cargo fix`D-confusingDiagnostics: Confusing error or lint that should be reworked.Diagnostics: Confusing error or lint that should be reworked.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.