Live data from Hacker News

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

github.com

121–130 of 366 posts

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

#121
post #7

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

Rust has lots of undefined behavior, in general a broadly similar set to that which exists in C. What Rust does that is different is that to trigger undefined behavior, you need to execute unsafe code. (This isn't the same as saying that you have to be in unsafe code--you can violate a precondition in unsafe code and have the UB itself trigger in safe code).

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

#122
I'm curious, but unable to ascertain, does the same problem exist in the original Zig code? Is this an issue introduced by the translation to Rust? Because if it is a problem that can be replicated in both code bases, it seems a point in Rust's favor, that the issue is easily identifiable with tools that exist in its ecosystem.

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

#124

Earlier quoted context omitted.

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.

Ctrl + F "only" is only in your messaging not mine. I never said they were the only ones doing this? It's not just politicians, celebrities know about this and will use it to their advantage. Whoever makes the headlines first might have a stronger sway over their adversaries. I'm not even poking at any side in particular, this is reality across the board unfortunately. People will just blindly take and believe the primary headlines.

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

#125
post #27

Earlier quoted context omitted.

>There are well-known tools in the Rust ecosystem that detect this kind of error Yes, tools like Miri, which this very post is about.

Indeed. My point is that just using the standard tools in the Rust ecosystem - like miri - would have trivially uncovered this error before it made it to the mainline.

This is an engineering choice: do you merge first and then fix the remaining issues or do you get everything perfectly clean first and then merge?

I've seen large rewrites and migrations take both approaches -- in my experience, the former usually works out better.

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

#126

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"?

You could view it as a specific application of the quote.

In your quote, there is no time-dependency between the lie and the truth. Whereas here, it's an attractive lie (easily parsed, great narrative), followed up by truths (that need more than surface-level analysis).

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

#127

Earlier quoted context omitted.

The author kept bragging about classes of bugs that would not happen with Rust.

A bug-for-bug port to Rust is the first step to fixing that. Assuming the port is actually 1:1 without any behavioral changes, these bugs already exist in the Zig code. The difference is now it's known where effort can be dedicated in order to one day have a memory-safe release of Bun. People have absolutely lost their mind over this and completely forgotten the benefits Rust gives you. I feel like I've gone back 10…

[flagged]

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

#128
post #93

What I don't understand is if they were going to translate Zig to unsafe Rust, why not just build a translation tool for it? You could do a one-to-one mapping of language constructs, hardcoding patterns in your codebase, and as one friend put it "Tbh they could've just hooked up zig translate-c to c2rust". They would get deterministic translation, would probably have not been a heavy investment to build, and the outp…

> why not just build a translation tool for it? They did ;) a highly dynamic one...

I mean, LLMs have been really good at translating code for a while now, which is why I'm more surprised that others are surprised this happened. They claim its a marketing trick despite the fact that they have to manage and maintain a fork of Zig if they don't switch languages.

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

#129
Certainly disagree with "AIs are not good at writing Rust". We can discuss the pros and cons of AI coding in general but in my experience they do just as well with Rust as any other language. If anything I'm impressed with how seamlessly the models can work with Rust's ownership model.

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

#130

Earlier quoted context omitted.

But nobody makes announcements and blog posts about running that.

There's several blog posts here. https://www.memorysafety.org/initiative/av1/

And the first post is about the team working on the project, with about two and a half sentences on c2rust, and making it very clear they just started.

The newer posts go into detail about the rearchitecting that follows.

Post reply on HN