-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Unused warnings should trigger for swaps #2911
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
Comments
I don't think the third case should warn. We have a pattern cropping up that goes something like this:
This is basically the dance that's needed to get an uncopyable into a closure in a way that you can move it to other places. |
Actually, I guess the problem is not whether the third example warns, but the fact that we have to do all that with it'd be nice to do stuff like...
|
The first and second example already issue warnings at the correct places. |
Sounds like this is done, then. |
The warning wouldn't apply in eholk's case because the lhs of the swap is an upvar. I still think my third case should warn. |
I am inclined to agree. |
Since the swap operator no longer exists, I think this can be closed (if I'm wrong, feel free to reopen!) |
Changes required due to: - rust-lang/rust@99ac405b96 Move MetadataLoader{,Dyn} to rustc_metadata. - rust-lang/rust@c997c6d822 Add more information to stable Instance - rust-lang#116915 This also fixes an issue in the `simd_shuffle` implementation that was exposed by the update. Resolves rust-lang#2911 --------- Co-authored-by: Celina G. Val <[email protected]> Co-authored-by: Adrian Palacios <[email protected]>
From @jruderman 's comment on #1832:
IMO, the "unused" warning should be per-assignment, not per-variable.
should warn because the first assignment to x is unused.
should warn because the second assignment to x is unused. Finally, the original example,
should warn because the second assignment to x is unused.
The text was updated successfully, but these errors were encountered: