Ring 1 Ring 0 Kernel Device drivers Applications Device drivers Least privileged Most privileged Chrislb, CC BY-SA 3.0. Hertzsprung, CC BY-SA 3.0. Virtual Machines ‐ Ravi, Nair. SimonWaldherr, CC BY-SA 4.0
let mut x = 7; let pointer = &x; // ⚠ cannot borrow `x` as mutable // because it is also borrowed as immutable let another_pointer = &mut x; *another_pointer += 1; println!("pointer = {}", pointer);
let pointer = &mut x; thread::spawn(|| { *pointer = 7; }); // ⚠ cannot borrow `x` as immutable // because it is also borrowed as mutable thread::spawn(|| { println!("x = {}", x); });