Hacker News new | ask | show | jobs
by nyanpasu64 2083 days ago
Rust's borrow checker would prevent Example 5 from compiling, since once you add `cust` to the collection, you can't touch it anymore (unless you insert a clone or etc.). So in this case at least, the inability to reason about code can be resolved by banning mutable aliasing, without eliminating mutability.
1 comments

Rust's ownership system would prevent example 5 from working (because you have to move the instance into the set).

The borrow checker is about validating that references don't outlive their target, and R^W.

Oops.