-
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
Avoid spurious "previous iteration of loop" errors #87998
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @wesleywiser (or someone else) soon. Please see the contribution instructions for more information. |
r? @estebank for diagnostics |
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #80522) made this pull request unmergeable. Please resolve the merge conflicts. |
@estebank (or @wesleywiser, etc.): Could I get some feedback on this PR? |
…" errors. Only follow backwards edges during get_moved_indexes if the move path is definitely initialized at loop entry. Otherwise, the error occurred prior to the loop, so we ignore the backwards edges to avoid generating misleading "value moved here, in previous iteration of loop" errors. This patch also slightly improves the analysis of inits, including NonPanicPathOnly initializations (which are ignored by drop_flag_effects::for_location_inits). This is required for the definite initialization analysis, but may also help find certain skipped reinits in rare cases. Patch passes all non-ignored src/test/ui testcases.
@rustbot label: +A-diagnostics +D-papercut |
r? @oli-obk |
@bors r+ |
📌 Commit 6ff5b47 has been approved by |
⌛ Testing commit 6ff5b47 with merge a96024910d3b9c35b06242b5aa6fb14ffdeaf714... |
💔 Test failed - checks-actions |
@bors retry |
This comment has been minimized.
This comment has been minimized.
☀️ Test successful - checks-actions |
Finished benchmarking commit (6dc08b9): comparison url. Summary: This benchmark run did not return any relevant changes. If you disagree with this performance assessment, please file an issue in rust-lang/rustc-perf. @rustbot label: -perf-regression |
Only follow backwards edges during
get_moved_indexes
if the move path is definitely initialized at loop entry. Otherwise, the error occurred prior to the loop, so we ignore the backwards edges to avoid generating misleading "value moved here, in previous iteration of loop" errors.This patch also slightly improves the analysis of inits, including
NonPanicPathOnly
initializations (which are ignored bydrop_flag_effects::for_location_inits
). This is required for the definite initialization analysis, but may also help find certain skipped reinits in rare cases.Patch passes all non-ignored src/test/ui testcases.
Fixes #72649.