3 ms·
UnsafeCell (a wrapper for all the hacky unsafe memory access) is such a great idea. This allows rest of the program to be easier to statically analyze. For ever
by pornel 4y ago
UnsafeCell (a wrapper for all the hacky unsafe memory access) is such a great idea. This allows rest of the program to be easier to statically analyze. For everything not in it, the compiler can assume it respects strict aliasing and immutability without any gotchas.
If UnsafeCell didn't exist it, it would be unclear where the programmer really meant to allow data races or poke holes in immutability, etc.