Live data from Hacker News

Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

github.com

11–20 of 366 posts

Re: Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

#12

There's a book that changed a lot of the way I think about attention and media [0]. The book isn't very good, but it flags something relevant here. There is a huge asymmetry between the reach of a big, flashy announcement (here: bun was re-written in memory-safe rust in a couple weeks), and the relatively small reach of a correction (often just a footnote on an old article, here a GH issue). This asymmetry is well un…

Not just marketing and PR, the mainstream media knows that pushing out BS and then retracting it later can have lasting effects because people will remember the original article / headline, and never see the correction.

only the mainstream media knows about this? Quite odd to qualify media this way here, when most of all media uses this mechanism. We also forgot politicians who are experts in this field.

Re: Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

#13

This had to happen, for many reasons: - Its a throw thing at the wall and see what sticks situation - LLMs will improve* - Using LLMs in an agentic way will improve (git worktrees, sliced PRs, spec driven steps) So what happened here is a mess, but you gotta break a few eggs to make a souffle. It's a learning step and I am glad it happened, there will be so many things to debrief from this. I don't use Bun or Rust bu…

A souffle has not been made

Re: Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

#15
post #4

That kind of error was expected. I don't see it as an issue against the rewrite. They kept the stable versions on Zig in case ppl needs stability. Eventually, the errors will get fixed.

That kind of error was entirely avoidable. There are well-known tools in the Rust ecosystem that detect this kind of error and while the tools do not detect all instances of UB caused by mistakes in unsafe blocks, it's still considered good practice to run them.

Re: Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

#16
post #7

I thought Rust treated undefined behaviour as a compiler bug? Does anyone know what's actually happening here?

They are using unsafe since large portions of Bun is interfacing with other unsafe codebases. Together with a "1:1" rewrite from Zig to Rust.

And it's not like Bun when written in Zig has been a beacon of stability either. It has been segfaults all over the place.

Re: Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

#17
post #7

I thought Rust treated undefined behaviour as a compiler bug? Does anyone know what's actually happening here?

It is only allowed in unsafe blocks. As long as the unsafe blocks are few and well understood then Rust programmers can contain this to a small well defined portion of a program.

Re: Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

#18

Maybe they want a quick switchover and the UB is replicating existing problems so it is net neutral for the codebase (but positive future coz developers can do future work on rust without synchronizing two codebase? ).

If that was true, then I would expect followups to reduce UB and unsafe in general, or at least requiring a lifetime for caller-owned memory.

But I think their true strategy is to have AI produce "fixes" like these which will end up infecting the entire codebase: https://github.com/oven-sh/bun/pull/30728

Re: Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"

#20

There's a book that changed a lot of the way I think about attention and media [0]. The book isn't very good, but it flags something relevant here. There is a huge asymmetry between the reach of a big, flashy announcement (here: bun was re-written in memory-safe rust in a couple weeks), and the relatively small reach of a correction (often just a footnote on an old article, here a GH issue). This asymmetry is well un…

Is this the concept that's referred to in the quote "a lie can travel halfway around the world before the truth puts on its shoes"?
Post reply on HN