Closed
Description
is this code:
struct Foo;
impl Foo {
fn bar(&mut self) -> bool { true }
}
fn error(foo: &mut Foo) {
if let Some(_) = Some(true) {
} else if foo.bar() {}
}
fn ok(foo: &mut Foo) {
if let Some(_) = Some(true) {
} else {
if foo.bar() {}
}
}
fn main() {}
yielding:
rustc 1.16.0 (30cf806ef 2017-03-10)
error[E0301]: cannot mutably borrow in a pattern guard
--> <anon>:9:15
|
9 | } else if foo.bar() {}
| ^^^ borrowed mutably in pattern guard