1 A variable already borrowed as immutable was borrowed as mutable.
3 Erroneous code example:
8 let y = &a; // a is borrowed as immutable.
9 bar(a); // error: cannot borrow `*a` as mutable because `a` is also borrowed
15 To fix this error, ensure that you don't have any other references to the
16 variable before trying to access it mutably:
19 fn bar(x: &mut i32) {}
27 For more information on Rust's ownership system, take a look at the
28 [References & Borrowing][references-and-borrowing] section of the Book.
30 [references-and-borrowing]: https://doc.rust-lang.org/book/ch04-02-references-and-borrowing.html