rustc error report suggests uncompilable #[derive(PartialEq.into())]
#123132
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
D-invalid-suggestion
Diagnostics: A structured suggestion resulting in incorrect code.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
The compile failure is legitimate: I've tried to derive
PartialEq
forBar
, butFoo
is notPartialEq
in turn, and therefore, neither isOption<Foo>
.But the existence of
WeirdOption
in the compilation, even though nothing refers to it, has caused rustc to get so confused that it suggests I write#[derive(PartialEq.into())]
, which is not even syntactically legal, and as far as I can see, wouldn't mean anything comprehensible if it were.If
WeirdOption
and all its impls are commented out, then I get a much more sensible error message, telling me thatFoo
needs to implementPartialEq
, and suggesting that I try doing this with a derive. That's the text that I've pasted into "Desired output" as a suggestion of better output in this case.(This is a cut-down test case from application code;
WeirdOption
was originallyrkyv::ArchivedOption
, which was a transitive dependency that I hadn't even known was in my compile at all until seeing this error message.)I looked for existing issues along these lines; the closest I found was #122919, about a similarly spurious
ref
in a suggestion. But that one is fixed as of 2024-03-22, and this still fails in 2024-03-26, so I don't think they're the same issue.Other cases
No response
Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: