1 // Tests that a closure which mutates a local variable
2 // cannot also be supplied a borrowed version of that
3 // variable's contents. Issue #11192.
11 println!("drop {}", self.x);
18 let mut ptr: Box<_> = Box::new(Foo { x: 0 });
19 let mut test = |foo: &Foo| {
20 ptr = Box::new(Foo { x: ptr.x + 1 });
22 test(&*ptr); //~ ERROR cannot borrow `*ptr`