-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
(Inspired by the question in https://users.rust-lang.org/t/returning-different-types-in-match-arms/73508?u=scottmcm)
When you get an error like https://play.rust-lang.org/?version=nightly&mode=debug&edition=2021&gist=b1f5ac9c4d61db01d47d3a3927cfb544
error[E0308]:
match
arms have incompatible types
It would be nice to have that be a separate error code from the "you passed the wrong type to a function" errors.
Because the existing explain for E0308 talks more about the "there's only one valid type" case.
Ideally we could have a separate error code for the match
/if
arms with different types case, so that the explain for that would could talk about the "make an enum
" or "use Box
-of-dyn
" solutions.
estebank
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsA-inferenceArea: Type inferenceArea: Type inferenceT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.