news.volyx.in

Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust" (github.com)

488 points by ndiddy · 106 days ago · 345 comments on HN

Article summary

The Bun project's codebase, recently rewritten in Rust, has been found to contain undefined behavior due to the use of unsafe code. The issue was discovered through the use of the Miri tool, which checks for undefined behavior in Rust code. The project's authors had cited Rust's safety features as a motivation for the port, but the current implementation does not yet take full advantage of these features. The codebase is still a work in progress and has not been claimed to be bug-free or production-ready.

Main themes

  • Rust porting
  • Memory safety
  • Undefined behavior
  • Code review
  • Language migration
  • AI-generated code

What commenters say

  • The announcement of the Rust port was misleading, as it implied a level of safety and completeness that is not yet achieved.
  • The use of AI-generated code can lead to issues like this, as it may not fully understand the nuances of the target language.
  • The criticism of the codebase is unfair, as it is a work in progress and not intended to be production-ready.
  • The porting process should have been done in a more incremental and transparent way, with clearer communication about the current state of the codebase.
  • The focus on safety and memory management in Rust is being misunderstood, and the language's guarantees are not being properly utilized in this implementation.
  • The issue is not with the Rust port itself, but with the way it was announced and presented to the public, creating unrealistic expectations.
  • The codebase's use of unsafe code is a necessary step in the porting process, and will be addressed in future iterations.
  • The community's reaction to the issue is overly negative and critical, and fails to recognize the challenges and complexities of the porting process.