Mismatched types should suggest From/Into conversions #56181
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
This program (Playground):
errors with
but there is an impl of
From<File>
forStdio
, such that this code (Playground):compiles and works as expected.
The error message should have a note stating that there is a conversion available, and a fix suggestion. That would be a huge boon for API discoverability. If there are multiple APIs that take
File
and returnStdio
, the error message should suggest some of them with some sort of prioritization (From
/TryFrom
traits,::from
/::new
methods,.as_...
methods, etc.)The text was updated successfully, but these errors were encountered: