-
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
Cannot mutably borrow in a pattern guard false positive #37510
Comments
Duplicate of #28449, I think. |
I'm hitting this as well. #28449 was closed without much reason. There's only some talk about why the current behavior is what it is, but no mention about why the current behavior is correct. Is there any reason the above code doesn't desugar to something like match opt {
Some(_) => {},
_ => if foo(&mut x) {
}
} It seems like that would be the correct implementation :|. |
This code compiles today as far as I can tell. I'm going to mark as E-needstest. |
Add tests for a few issues. Fixes rust-lang#41998 Fixes rust-lang#38381 Fixes rust-lang#37515 Fixes rust-lang#37510 Fixes rust-lang#37508 Fixes rust-lang#37366 Fixes rust-lang#37323 Fixes rust-lang#37051 Fixes rust-lang#36839 Fixes rust-lang#35570 Fixes rust-lang#34373 Fixes rust-lang#34222 Certainly not all of the E-needstest issues right now, but I started to get bored.
This code fails to compile:
error
I believe this is a bug, because you can just add a pair of braces to "fix" it:
The text was updated successfully, but these errors were encountered: