1 // Issue 27282: Example 2: This sidesteps the AST checks disallowing
2 // mutable borrows in match guards by hiding the mutable borrow in a
3 // guard behind a move (of the mutably borrowed match input) within a
6 // This example is not rejected by AST borrowck (and then reliably
7 // reaches the panic code when executed, despite the compiler warning
8 // about that match arm being unreachable.
10 #![feature(if_let_guard)]
15 //~^ ERROR use of moved value: `b` [E0382]
17 _ if { (|| { let bar = b; *bar = false; })();
19 &mut true => { println!("You might think we should get here"); },
20 _ => panic!("surely we could never get here, since rustc warns it is unreachable."),
25 //~^ ERROR use of moved value: `b` [E0382]
28 (|| { let bar = b; *bar = false; })();