Why Rust prevents from multiple mutable references?
Like in the topic, why Rust prevents from multiple mutable references? I have read chapter in rust-book, and I understand that when we have multi-threaded code we are secured from data races but let's look at this code: fn main() { let mut x1 = String::from("hello"); let r1 = &mut x1; let r2 = &mut x1; r1.insert(0, 'w'); } This code is not running simultaneously so there is no possibility for data races. What is more when I am creating new thread and I want to use variable from parent thread in a new thread I have to move it so only new thread is an owner of the parent variable. The only