4 ms·
It goes further- immutable/shared references get the same treatment as they will not change out from under you either. The thing that disables it is interior m
by Rusky 5y ago
It goes further- immutable/shared references get the same treatment as they will not change out from under you either.
The thing that disables it is interior mutability- types like `Mutex` or `Cell` that can be mutated through shared references fall back to something like C without TBAA.
- masklinn 5y ago`Mutex` (and `RwLock`) should not since they grant exclusive access, should they? As long as the aliasing information doesn't live across lockings, but that doesn't seem like it would happen: each locking would hand out a different guard, and thus a different reference the optimiser wouldn't see relating at all to the previous locking.
- Rusky 5y agoRight, you should get noalias optimizations within a particular locking, but not on the outer `&Mutex` references.