-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Matching a partially moved value results in weird runtime behavior. #17385
Comments
|
Minimal: struct X(int);
impl Drop for X {
fn drop(&mut self) { }
}
fn main() {
let foo = X(1i);
drop(foo);
match foo {
X(1i) => (),
_ => unreachable!()
}
} This shouldn't compile at all. |
Nominating. |
Looks like a regression. 0.10 rejects this code. |
ghost
mentioned this issue
Sep 20, 2014
bors
added a commit
that referenced
this issue
Sep 23, 2014
This is to make sure it hadn't been moved if there are no bindings in any of the arms. Fixes #17385.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sorry for not providing smaller case but I hope this is better than nothing:
https://github.com/dpc/rustyhex/blob/broken/src/ui/piston.rs#L744
Both versions works (compile and start), but runtime behavior changes. The code that follows the above part:
will match
Press(Keyboard(_))
no matter whati
really is, if the value is partially moved (so mouse events are updating my game). If I use the version withi.clone()
, the code works as intended and game is updated only on keyboard presses.The text was updated successfully, but these errors were encountered: