From my understanding, the mut
in let mut
means a mutable variable binding, while the mut
in &mut
means an exclusive borrow. However, the following code:
fn main() {
let x = 1;
let x_ref = &mut x;
}
won't compile. It looks like that the mut
in let mut
does not only mean a mutable variable binding, but also implies curtain mutable borrow constraints. What's the precise semantics of mut
in let mut
?