2 ms·
The point is that it keeps track of multiple references and disallows mutable and immutable references at the same time across threads, for example, and disallo
by lionkor 3y ago
The point is that it keeps track of multiple references and disallows mutable and immutable references at the same time across threads, for example, and disallows multiple mutable references altogether.
The rust borrow checker works on values, and all that, not just on objects with RAII.
- School-Cotton 2y agoMutable references can never coexist with other references in Rust, regardless of whether they're on different threads. This will not compile: let x = 42; let r1 = &x; let m1 = &mut x; println!("{r1}");