The "this and all prior arms are found to be of type" diagnostic is less helpful for many unreachable branches #121144
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
If we try this code:
Current output
We get this output:
Desired output
The diagnostic could point out which branch (or branches) caused the type to be
Option<u16>
, preferably skipping branches which are not reachable.Other cases
Note that if we reduce the number of branches to 4, we get a complete enumeration of branches. While more helpful, could still be improved by skipping and possibly noting the number of branches that have been skipped due to not being reachable:
Rust Version
Anything else?
Playground Link
The text was updated successfully, but these errors were encountered: