Unhelpful error message when comparing an array of types that are not comparable #95285
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
D-terse
Diagnostics: An error or lint that doesn't give enough information about the problem at hand.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Given the following code: https://play.rust-lang.org/?version=stable&mode=debug&edition=2021&gist=46491383b2d69ee047fd7312d8ba7c94
The current output is:
Ideally the output should look like:
This error could be confusing for beginners or even experienced rust programmers because it does not explain why one can't compare such type. It should point out that type is not comparable and suggest to implement
PartialEq<{TYPE}>
where{TYPE}
is type of the thing they tried to compare it with.For example, another error that can occur:
This error message explains in details, why the comparison isn't possible to do: types
Vec<{integer}>
and[X; 3]
are not comparable because of the absence of thePartialEq
implementation.E0369
should look like it.The text was updated successfully, but these errors were encountered: