Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



`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.


Right, you should get noalias optimizations within a particular locking, but not on the outer `&Mutex` references.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: