"Binding is possibly uninitalized" reports some additional spans incorrectly in addition to the correct one #126133
Labels
A-control-flow
Area: Control flow
A-diagnostics
Area: Messages for errors, warnings, and lints
D-papercut
Diagnostics: An error or lint that needs small tweaks.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Code
Current output
Desired output
Rationale and extra context
Yes
bar
is not initialized in theE::A
arm, but the goal of the diagnostic should be to print the spans that the user needs to *fix*. TheE::A
arm diverges so the user only needs to fix theE::B
arm. So the report forE::B
is correct, but the one forE::A
should not be emitted.Other cases
My original code that triggered this was similar to wrapping the whole body of
foo
in aloop {}
and usingbreak
instead ofreturn
. The rationale is the same.Rust Version
Anything else?
No response
The text was updated successfully, but these errors were encountered: