Hacker Newsnew | past | comments | ask | show | jobs | submit | winterlights's commentslogin

Efficiently implementing a doubly linked list in C or C++ is easy. In Rust, less so.[0]

And the prevalence and difficulty of unsafe means both that Rust is not memory safe [1], and that Rust sometimes is less memory safe than C or C++.

[0]: https://rust-unofficial.github.io/too-many-lists/

[1]: For an example of memory unsafety in Rust: https://materialize.com/blog/rust-concurrency-bug-unbounded-...


You can write a linked list in Rust the same was as C or C++ with unsafe, so it as least as easy.


While I think it’s a troll account, it is technically true that the rules around unsafe Rust are a little harder to get exactly right to avoid UB because you still have to uphold the much larger surface area of rules in safe Rust without any of the compiler help. C++ by contrast of course has fewer such rules and they’re easier to reason about but of course there’s no compiler warning when you violate them.

On the other hand that line of argument is kind of weak sauce because the vast majority of bugs aren’t in complicated recursive data structures. And you can always implement doubly-linked list in pure safe rust just with slightly more overhead by using Rc/Arc if you wanted guarantees (and you can also verify the unsafe implementation using Miri which is a significantly strong runtime checker than c++ where you only have ASAN/UBSAN)


Did you actually create this account just to hate on Rust?


Similar to how Rust clearly is not memory safe, Go is also not memory safe.


Not sure what this is saying but you can create a trivial concurrent program that violates the memory safety guarantees Go is supposed to provide [1]: https://biggo.com/news/202507251923_Go_Memory_Safety_Debate

That is not true of Rust.


> [You can] create a trivial concurrent [Go] program that violates the memory safety guarantees ... > That is not true of Rust.

It's not supposed to be, but Rust does have plenty of outstanding soundness bugs: https://github.com/rust-lang/rust/issues?q=state%3Aopen%20la...

Rust as intended is safe and sound unless you write u-n-s-a-f-e, but as implemented has a ways to go.


The whole discussion sucks, because Rust is not memory safe, and can easily be worse than C and C++ regarding memory safety. Memory unsafety is entirely possible in Rust[0].

[0]: https://materialize.com/blog/rust-concurrency-bug-unbounded-...


Looks like unsafe code doing the actual freeing.. unsafe Rust has never been claimed to be memory safe.


Not sure where that comes from. We're not even discussing Rust in this thread.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: