-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
Fix spurious 'value moved here in previous iteration of loop' messages #73600
Conversation
Fixes rust-lang#46099 Previously, we would check the 'move' and 'use' spans to see if we should emit this message. However, this can give false positives when macros are involved, since two distinct expressions may end up with the same span. Instead, we check the actual MIR `Location`, which eliminates false positives.
(rust_highfive has picked a reviewer for you, use r? to override) |
LL | test!({b}); | ||
| ^ | ||
| | | ||
| value moved here | ||
| value used here after move |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a reason this is not formatted as
LL | test!({b}); | |
| ^ | |
| | | |
| value moved here | |
| value used here after move | |
LL | test!({b}); | |
| ^ value moved here | |
| | value used here after move |
It's outside the scope of this PR, just wondering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure - I think that might just be how the diagnostic framework formats messages.
Nice. @bors r+ |
📌 Commit 953104e has been approved by |
@bors rollup |
Rollup of 7 pull requests Successful merges: - rust-lang#71756 (add Windows system error codes that should map to io::ErrorKind::TimedOut) - rust-lang#73495 (Converted all platform-specific stdin/stdout/stderr implementations to use io:: traits) - rust-lang#73575 (Fix typo in error_codes doc) - rust-lang#73578 (Make is_freeze and is_copy_modulo_regions take TyCtxtAt) - rust-lang#73586 (switch_ty is redundant) - rust-lang#73600 (Fix spurious 'value moved here in previous iteration of loop' messages) - rust-lang#73610 (Clean up E0699 explanation) Failed merges: r? @ghost
Fixes #46099
Previously, we would check the 'move' and 'use' spans to see if we
should emit this message. However, this can give false positives when
macros are involved, since two distinct expressions may end up with the
same span.
Instead, we check the actual MIR
Location
, which eliminates falsepositives.