| > Obviously the standard library uses some "unsafe" as well, for instance. Most beautifully, MaybeUninit<T>::assume_init() -> T This unsafe Rust method says "I promise that I actually did initialize this MaybeUninit<T>, so give me the T". In terms of the resulting program the machine is not going to do any work whatsoever, a MaybeUninit<T> and a T are the same size, they're in the same place, your CPU doesn't care that this is a T not a MaybeUninit<T> now. But from a type safety point of view, there's all the difference in the world. Even though it won't result in emitting any actual CPU instructions, MaybeUninit::assume_init has to be unsafe. Most of the rest of that API surface is not. Because that API call, the one which emitted no CPU instructions, is where you took responsibility for type correctness. If you were wrong, if you haven't initialized T properly, everything may be about to go spectacularly wrong and there's no-one else to blame but you. |