Earlier quoted context omitted.
Re #3: vtable pointers aren't mutable...?
Of course they are. The pointers to the vtable are part of the object. They aren't mutable fields as per the language, but for security concerns it doesn't matter what the language thinks. Being part of the object, the vtable pointer has to live in a writeable memory mapping (like stack / heap).
Claude Code uses Bun written in Rust now
771–780 of 920 posts
Re: Claude Code uses Bun written in Rust now
#772Earlier quoted context omitted.
> Why does changing to Rust kill the project? I don't understand the point here. I'm concerned that the complete rewrite in an entirely different language is not a sound technical decision and instead is a ploy to shed copyright claims from past contributors. Now, based on comments from this thread, the formerly FLOSS project is somehow granting special access to a corporation that apparently is invested in going way…
A lot of hypotheticals, conjecture, speculation, personal feels devoid of any facts. That somehow kills the project. ok!
No,not really. There is only one point: does Bun acknowledge that past contributors still hold copyright over the Rust rewrite?
Re: Claude Code uses Bun written in Rust now
#773Earlier quoted context omitted.
> You can just do that, and then Zig is really no less robust than Rust. That's just it, using Zig required more rigorous engineering than the Bun team were capable of.
People tried to "just do that" (write their programs in a memory safe way) in C and other languages with manual memory management for decades, and we have countless vulnerabilities that prove this simply doesn't work. That's why newer languages, with the notable exception of Zig, prefer more advanced memory management methods.
Who are these "people" you speak of? It's possible to write software in low level languages that don't have these problems. Not a "non-zero" it might be possible, it can be done thoughtfully, and the popular notion it can't be done is backed only by incomplete anecdotes.
Should everything be written in low-level languages? No, that would be absurd. Is it a simple fact of life that not every person/team/organisation is capable of meeting certain standards of rigour? Yes. That's not to say anyone in the Bun team could not become sufficiently competent in the future. For whatever reason, current experience, incentives, and personal motivations did not make for a conducive environment to make Bun watertight in Zig.
Re: Claude Code uses Bun written in Rust now
#774Earlier quoted context omitted.
Borrow-checking the dereference of a stale pointer won't be worth much, though.
Sure; but I bet raw pointers are used very infrequently in the new codebase. The code was ported from zig to rust. I bet a lot of pointers became rust references in the process.
Re: Claude Code uses Bun written in Rust now
#775Earlier quoted context omitted.
Relative "number of unsafe keywords" or "lines inside unsafe blocks" isn't a good metric. It's unsafe to call a C library that gives you a raw pointer, that can be a single line. It's unsafe to use that pointer, that could be a second single line. Carrying that pointer around, the data structures it's in, that's all safe, and doesn't implicate lifetime checking at all, so Rust will let you do silly things with the ac…
Yeah, one needs to understand that "unsafe" does not mark which parts of the code are actually unsafe, it simply marks parts where the compiler ignores parts of its rule set. But the implications can crop up anywhere, there is no guarantee that a resulting use-after-free or similar can only happen inside the unsafe blocks. In short, if you use an unsafe block, then potentially any part of your code is unsafe.
This is a common misconception, in a literal interpretation. It doesn't invalidate your point, but since people get the wrong impression: unsafe doesn't turn off any of the checks the Rust compiler does.
It allows you to perform 5 additional operations, and that's it. Using those operations wrong is what breaks the safety promises of the language. As an example, you could dereference a raw pointer and tell the Rust compiler it lives forever, when it's really a pointer to an object that's about to be freed.
Re: Claude Code uses Bun written in Rust now
#776Earlier quoted context omitted.
> But the whole point of their product is that it supposedly nullifies such "business" concerns around the use of technology, by making it cheap and fast to build whatever you like automatically. This is a spectrum, it's not just 0% vs 100%. Even Fable frakked up a few things really badly in my professional work (though to its credit after a very detailed 2h chat it self-corrected and fixed all the blunders). I would…
> Reminder that the Bun's Zig-to-Rust rewrite took 11 days with dozens of agents working 24/7 and the author put the cost they'd pay (if they had to pay) at about $168k. Does anybody really believe that it only took 11 days, one engineer and $168k in tokens?
Re: Claude Code uses Bun written in Rust now
#777Earlier quoted context omitted.
True, but unsafe let's you conjure up any lifetime you want, or any lifetime necessary to satisfy the lifetime requirements in safe code. If you generously sprinkle pointer dereferences in unsafe code, you effectively disable the protection provided by the borrow checker – including in safe code – until you've checked and verified the correctness of all unsafe blocks.
> True, but unsafe let's you conjure up any lifetime you want The only thing unsafe does is let you have an unbounded lifetime. As I said, it doesn't check those: fn get_str (s: *const String) -> &'a str { unsafe { &*s } } https://doc.rust-lang.org/nomicon/unbounded-lifetimes.html > if you generously sprinkle pointer dereferences in unsafe code, you effectively disable the protection provided by the borrow checker Yo…
No, you're wrong: You can create any lifetime. Proof:
fn oof(x: &u32) -> &'desired u32 {
let ptr = x as *const u32;
unsafe { &*ptr }
}
This will take a reference and return it with any lifetime specified by the caller.> You don't disable anything.
I said "effectively disable". For example:
fn trust_me_bro(x: mut u32) -> &'a mut u32 { unsafe { &mut x } }
fn main() {
let mut x = 1_u32;
let reference_a = &mut x;
let reference_b = trust_me_bro(reference_a);
*reference_b = 2; -- Whoops
println!("reference_a: {reference_a} reference_b: {reference_b}");
}
After the call to trust_me_bro, two aliasing, mutable references exist simultaneously. This would usually be prevented by the borrow checker, but the unsafe code has effectively disabled it.Re: Claude Code uses Bun written in Rust now
#778Re: Claude Code uses Bun written in Rust now
#779The port of Bun, which has >5000 open github issues, is used in Claude Code, which has >11000 open github issues. Do people use Bun in things that are expected to work reliably? Have any such projects tried the upgrade yet?
To be fair, https://github.com/python/cpython has over 5k open github issues, and that's still generally considered fairly reliably technology even if a lot of HN users seem to hate it.
cpython has ~7,000 open issues, but ~70,000 closed ones, a 1:10 ratio. Bun's ratio is above 1:2.5, while for Claude Code it's slightly over 1:6.
Much more importantly, though, Bun's oldest issue is from Sep 2021, while Claude Code's is Feb 2025. cpython's oldest issue dates from June 2000 (presumably migrated from an older tracker). Claude Code has very nearly the same total number of issues (open + closed) as cpython at around 77,000, but Claude Code has done it in a year an a half whereas cpython has taken 26 years to get there.
It's a good comparison to pick, as it can't be explained by popularity. For all the real-world use Claude Code sees, it's nowhere near what cpython sees, even over the year and a half in question. Bun, meanwhile, is hitting these numbers while not even being the mainstream choice for what it does (node still holds that crown afaik).
Re: Claude Code uses Bun written in Rust now
#780Earlier quoted context omitted.
Why does changing to Rust kill the project? I don't understand the point here.
Emphasis on the FOSS project. The v1.4 mentioned is not (yet?) open source, Claude Code is essentially using a proprietary fork, was GP's point.
We have run it in production for a month: https://www.prisma.io/blog/bun-rust-rewrite-prisma-compute