InteriorAssign trait { a := b }
Rust Internals [Unofficial]
May 10, 2026
Another use case for an overloadable assignment unrelated to interior mutability is inserting items into a HashMap, which currently cannot be done using map[key] = ... syntax, because it could not avoid panicking on an absent key, because right now the only trait for this is IndexMut which requires returning &mut to an existing, initialized place. In general, Rust assignment currently demands &mut, but producing &mut is not always possible or wise even when an assignment-like operation is possible.
Discussion in the ATmosphere