4 ms·
Right, so if &mut is always unique anyway then the presence of an UnsafeCell shouldn't affect it, since it's about weakening guarantees. In fact, looking at th
by Rusky 8y ago
Right, so if &mut is always unique anyway then the presence of an UnsafeCell shouldn't affect it, since it's about weakening guarantees.
In fact, looking at the compiler output (https://godbolt.org/g/kt2xfW https://godbolt.org/g/kt2xfW), it looks like only &T has noalias, and not &mut T. It does go away in the presence of UnsafeCell, but for &mut T it was never there in the first place.
So either that's a place where we can still add more noalias annotations, or it's off for some subtle reason I'm not familiar with.
- steveklabnik 8y agoYou won’t get the noalias stuff on &mut T until ththen next release, as I mentioned above, due to an LLVM bug.
- Rusky 8y agoAh, right; missed that part of what you were saying. If you switch the compiler version on my godbolt link to beta, the &mut i32 and &mut UnsafeCell<i32> both have the noalias attribute, so looks like it's on track. :)