-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of uninitialized variable after pattern error #60350
Comments
I will like to work on this bug. On initial findings, the initial pattern error is coming from https://github.com/rust-lang/rust/blob/master/src/librustc_mir/hair/pattern/check_match.rs#L261. My hypothesis is that because of the pattern error, we don't add x to a list of initialized variables and hence we get the uninitialized error. Does that sounds like a good start? |
KindThe place to start looking would be here: rust/src/librustc_mir/build/matches/mod.rs Lines 417 to 470 in 472211a
You'll need to use the functions in |
@matthewjasper We now have two errors instead... is there anything more to do here, e.g. improving diagnostics? |
Implement MIR lowering for or-patterns This is the last thing needed to get meaningful run-pass tests for or-patterns. There probably need to be more tests before stabilizing this, but the most important cases should have been covered. Note: we can generate exponentially large MIR CFGs when using or-patterns containing bindings, type ascriptions, or that are for a match arm with a guard. `src/test/mir-opt/exponential-or.rs` shows the best case for what we currently do. cc #54883 closes #60350 closes #67514 cc @Centril r? @pnkfelix
The following code reports a warning that
x
is uninitialized as well as the expected pattern error.playground
The text was updated successfully, but these errors were encountered: