1 // Issue 27282: Example 1: 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 ref mut pattern id) within a closure.
5 // This example is not rejected by AST borrowck (and then reliably
6 // segfaults when executed).
14 if { (|| { let bar = foo; bar.take() })(); false } => {},
15 //~^ ERROR cannot move out of `foo` in pattern guard [E0507]
16 Some(s) => std::process::exit(*s),