Idea: Shared Mutable References (`&shr mut T`)
Rust Internals
Idea: Shared Mutable References (`&shr mut T`)
Motivation &T and &mut T literally mean immutable references and mutable references, but more exactly, shared references and exclusive references. &mut T is mutable, also exclusive (assuming that we are not talking about UnsafePinned). That's not bad. However, &T is more complicated because of interior mutability. &T is immutable only when T: Freeze. For T: !Freeze, &T is not only mutable but also shared. What's more, there are no immutable references for T: !Freeze except wrapping T into a new ...
0 comments
No comments yet.