Implementing From
for associated type results in confusing error
#85576
Labels
A-associated-items
Area: Associated items (types, constants & functions)
A-coherence
Area: Coherence
A-diagnostics
Area: Messages for errors, warnings, and lints
D-confusing
Diagnostics: Confusing error or lint that should be reworked.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
Disclaimer: I am not sure if this an actual bug or rather a diagnostic issue.
The following simplified code
Playground
Produces the following incorrect/confusing error message on both stable and nigthly:
I encountered this issue when I wanted to wrap the result returned by
str::parse
for a type from crate A which uses an error type from another crate B, which I did not want to depend on and import directly. I am aware that using an associated type here has implications for backwards compatibility, but in this case this is actually desirable I think, since I only want to forward the result into my custom error type, even if the concrete error type in crate A/B changes.The text was updated successfully, but these errors were encountered: