4 ms·
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 Ru
by Manishearth 10y ago
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 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.