1 // check that existing borrows due to a closure capture give a special note
3 fn move_while_borrowed(x: String) {
9 fn borrow_mut_while_borrowed(mut x: i32) {
11 let y = &mut x; //~ ERROR
15 fn drop_while_borrowed() {
24 fn assign_while_borrowed(mut x: i32) {
30 fn copy_while_borrowed_mut(mut x: i32) {
36 fn borrow_while_borrowed_mut(mut x: i32) {
42 fn borrow_mut_while_borrowed_mut(mut x: i32) {
44 let y = &mut x; //~ ERROR
48 fn drop_while_borrowed_mut() {
52 f = || x = 0; //~ ERROR
57 fn assign_while_borrowed_mut(mut x: i32) {
63 fn copy_while_borrowed_unique(x: &mut i32) {
69 fn borrow_while_borrowed_unique(x: &mut i32) {
75 fn borrow_mut_while_borrowed_unique(mut x: &mut i32) {
77 let y = &mut x; //~ ERROR
81 fn drop_while_borrowed_unique() {
86 f = || *x = 0; //~ ERROR
91 fn assign_while_borrowed_unique(x: &mut i32) {
99 trait Fake { fn use_mut(&mut self) { } fn use_ref(&self) { } }
100 impl<T> Fake for T { }