-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Using by-value self with an immediate, implicity-copyable struct should pass a copy as the self param. #10615
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
Presumably this would be fixed if we handled |
This seems very bad, nominating. |
@huonw: Yes, lets please fix this issue once and for all rather than working around the symptoms. We shouldn't be passing |
Accepted for 1.0, P-backcompat-lang |
This should be closed now. (@luqmana) |
Well, the GitHub parser doesn't take stacked declarations: |
Thanks @eddyb! |
[arithmetic_side_effects] Fix rust-lang#10590 Fix rust-lang#10590 changelog: [`arithmetic_side_effects`]: Detect integer methods that can introduce side effects
Rename `integer_arithmetic` The lack of official feedback in rust-lang#10200 made me give up on pursuing the matter but after yet another use-case that is not handled by `integer_arithmetic` (rust-lang#10615), I think it is worth trying again. --- changelog: Move/Deprecation: Rename `integer_arithmetic` to `arithmetic_side_effects` [rust-lang#10674](rust-lang/rust-clippy#10674) <!-- changelog_checked -->
This is from a code sample sent to the mailing list: https://mail.mozilla.org/pipermail/rust-dev/2013-November/006924.html
Prints out:
The call to
squared
should be receiving a copy ofx
as the self param. This bug is only exhibited in the case of implicity copyable struct. If you add something like~int
to Value the compiler will rightly complain that x has been moved.Also, if you add another field (like
m: int
) making Value an immediate no longer, we see the right behaviour:The text was updated successfully, but these errors were encountered: