1 // Issue 27282: This is a variation on issue-27282-move-ref-mut-into-guard.rs
3 // It reborrows instead of moving the `ref mut` pattern borrow. This
4 // means that our conservative check for mutation in guards will
5 // reject it. But I want to make sure that we continue to reject it
6 // (under NLL) even when that conservaive check goes away.
12 ref mut r if { (|| { let bar = &mut *r; **bar = false; })();
13 //~^ ERROR cannot borrow `r` as mutable, as it is immutable for the pattern guard
14 false } => { &mut *r; },
15 &mut true => { println!("You might think we should get here"); },
16 _ => panic!("surely we could never get here, since rustc warns it is unreachable."),