4 ms·
I believe the post you are replying to was referring to the fact that you could take actions in that unsafe block that would compromise the guarantees of rust;
by rybosome 2y ago
I believe the post you are replying to was referring to the fact that you could take actions in that unsafe block that would compromise the guarantees of rust; eg you could do something silly, leave the unsafe block, then hit an “impossible” condition later in the program.
A simple example might be modifying a const value deep down in some class, where it only becomes apparent later in the program’s execution. Hence their analogy of the wet dog in a clean room - whatever beliefs you have about the structure of memory in your entire program, and guaranteed by the compiler, could have been undone by a rogue unsafe.
- School-Cotton 2y agoRust doesn’t have classes, nor can const values be modified, even in unsafe code. (did you mean “immutable”?)