Undefined vs. Unsafe in Rust
Tl;dr;Code in an unsafe block may generate undefined behavior if it is used incorrectly, but, if used correctly, will not.Rust code which is not in an unsafe block cannot generate undefined behavior (aside from bugs in the compiler/underlying libraries).