1 // ignore-tidy-linelength
3 //[mir]compile-flags: -Z borrowck=mir
5 fn inside_closure(x: &mut i32) {
8 fn outside_closure_1(x: &mut i32) {
11 fn outside_closure_2(x: &i32) {
18 outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
19 //[mir]~^ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
21 outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
22 //[mir]~^ ERROR cannot borrow `*a` as immutable because previous closure requires unique access