fn main() {
let mut s = String::from("hello");
let r1 = &mut s;
let r2 = &mut s; //error
println!("{}, {}", r1, r2);
}
|
4 | let r1 = &mut s;
| ------ first mutable borrow occurs here
5 | let r2 = &mut s; //error
| ^^^^^^ second mutable borrow occurs here
6 |
7 | println!("{}, {}", r1, r2);
| -- first borrow later used here