Error message suggests invalid Rust code with PartialEq<OtherType> and ToString #83320
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-bug
Category: This is a bug.
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.
Given the following code:
The current output is:
If we replace our code with compiler's suggestion, we end up with this code:
Which is invalid Rust.
I've only observed this happen with
PartialEq<Type>
andToString
being implemented.Related to: #63564
#63564 makes this error message even worse as it isn't obvious what's actually wrong here.
I reproduced this with today's nightly build (
2021-03-19 f5f33ec0e0455eefa72f
)Playground link: https://play.rust-lang.org/?version=nightly&mode=debug&edition=2018&gist=7ac536d0521cefa0cf1f088b9d88db1f
The text was updated successfully, but these errors were encountered: