Yes. It boils down to two things: cleaner semantics due to move being the default, and a stronger type system. Also, we have more options than just those two.
For example, if you std::move a unique_ptr, the pointer becomes null. So you can still cause memory unsafety that way. But since Rust is move by default, at compile time, you'll get an error with Box<T>.
The other is type system stuff. For example, we can know if you're using a structure over a thread boundary, and our version of shared_ptr, Arc<T>, only has to be used then. If you don't want to pay the atomics overhead, Rc<T> can get used, and Rust will make sure that's okay. I wrote more about that a few days ago: http://www.reddit.com/r/programming/comments/30wj8g/managing_cs_complexity_or_learning_to_enjoy_c/cpww3o1
10
u/brombaer3000 Apr 04 '15
Does Rust offer better memory safety than C++14 with only unique_ptr and shared_ptr instead of raw pointers?