4 ms·
In the given example they are not using the shared reference at all during the whole lifetime of the immutable reference and the operation on the immutable one
by pkolaczk 4y ago
In the given example they are not using the shared reference at all during the whole lifetime of the immutable reference and the operation on the immutable one does not change the object at all, so it would be actually safe. This is the situation where those two rules are a bit too strict and reject a valid program.
- masklinn 4y ago> In the given example they are not using the shared reference at all during the whole lifetime of the immutable reference and the operation on the immutable one does not change the object at all, so it would be actually safe. The compiler does not work at that level of resolution. It’s unclear that it should, even for a point query: there is no telling how much a weirdo ISA would bungle that if the two accesses came from different threads, for instance. > This is the situation where those two rules are a bit too strict and reject a valid program. Compilers will always, necessarily, reject valid programs. The alternative is to allow invalid programs.
- ArrayBoundCheck 4y ago> The compiler does not work at that level of resolution. It’s unclear that it should The correct solution is to never ever use rust. It's a failed experiment that noone noticed failed