Not quite, because depending on the compiler implementation / memory model, other things can also lead to UB, and thus be unsafe, e.g.:
* data races in a multi-threaded program
* type-casting to the wrong type (e.g. via unions) with compiler optimizations that rely on proper types
* assuming values are absolutely never aliased (shared xor mutable) when there's actually a way to create aliased values (e.g. unsafe {} and raw pointers)
* creating objects out of a sequence of bytes that is not valid for their type
Memory safety is a GC. Rust has a compile-time GC, interpreted languages have a run-time GC.
Not quite, because depending on the compiler implementation / memory model, other things can also lead to UB, and thus be unsafe, e.g.:
* data races in a multi-threaded program
* type-casting to the wrong type (e.g. via unions) with compiler optimizations that rely on proper types
* assuming values are absolutely never aliased (shared xor mutable) when there's actually a way to create aliased values (e.g. unsafe {} and raw pointers)
* creating objects out of a sequence of bytes that is not valid for their type
...and likely many others I can't remember.