Re:What Rust Can Do That Other Languages Can't
by Manishearth on Monday February 06, 2017 @11:13AM
(#13580807)
I think the messaging is like this because folks approach Rust and often try to write Rust code as if it were C. You can do this in C++; you can't do this in Rust.
unsafe is highly discouraged, but designing the innards of abstractions like datastructures is one of the places where you basically need it.
Be aware that good generic datastructures are just as hard in C++. See https://news.ycombinator.com/item?id=13580418 . Naive datastructure implementations often have strict aliasing bugs or mess up on the destruction behavior. Using unsafe to write datastructures in Rust isn't particularly hard; it's just as tricky as it is in C++. Having to use unsafe is annoying, but it's a minor annoyance. The nomicon helps teach how you're supposed to use unsafe.
unsafe is highly discouraged, but designing the innards of abstractions like datastructures is one of the places where you basically need it.
Be aware that good generic datastructures are just as hard in C++. See https://news.ycombinator.com/item?id=13580418 . Naive datastructure implementations often have strict aliasing bugs or mess up on the destruction behavior. Using unsafe to write datastructures in Rust isn't particularly hard; it's just as tricky as it is in C++. Having to use unsafe is annoying, but it's a minor annoyance. The nomicon helps teach how you're supposed to use unsafe.