Suggest dereferencing boxed enum when matching #57741
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-suggestion-diagnostics
Area: Suggestions generated by the compiler applied by `cargo fix`
Given the following code:
the compiler outputs:
Adding changing line 8 to
let y = match *x {
makes the code compile correctly (partly thanks to match ergonomics, I believe).The error message would ideally be closer to
Adding the suggestion should be relatively easy, condensing the multiple alternative match arm discriminants with mismatched type errors into one might be more involved.
@nikomatsakis should we consider extending the match ergonomics to also account for
Box
?Case taken from an old reddit post from a newcomer to the language.
The text was updated successfully, but these errors were encountered: