15 ms·
Bun Rust rewrite: "codebase fails basic miri checks, allows for UB in safe rust"
- prymitive 5mo agoAny prediction market bets on what will they rewrite it into next week? Era of just-in-vibe software is here.
- wg0 5mo agoNot a good advertisement for both Anthropic. Or bun.
- dangerlibrary 5mo agoThere'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 understood by marketing and PR professionals, and actively exploited. [0] https://en.wikipedia.org/wiki/Trust_Me,_I%27m_Lying https://en.wikipedia.org/wiki/Trust_Me,_I%27m_Lying
- giancarlostoro 5mo agoNot 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.
- beberlei 5mo agoonly 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.
- giancarlostoro 5mo agoCtrl + 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.
- alpinisme 5mo agoI don’t think the media care about having lasting effects. They just want to catch the wave of interest and not wait around and let someone else get the scoop while they fact check or add nuance.
- pavel_lishin 5mo agoIs 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"?
- kakugawa 5mo agoYou 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).
- kibwen 5mo ago> a big, flashy announcement (here: bun was re-written in memory-safe rust in a couple weeks) Did they even claim it was "memory-safe"? Every discussion of this topic has had dozens of comments noting that their vibed codebase is bursting at the seams with unaudited unsafe blocks, lightly reviewed by people who seem to not only seem to not understand Rust, but who seem incensed at the idea of needing to understand any programming language in the first place.
- scuff3d 5mo ago[dead]
- parchley 5mo agoThe author kept bragging about classes of bugs that would not happen with Rust.
- Anon1096 5mo agoA 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 years reading threads about the Rust port of Bun these are the exact same arguments we see from people advocating continued use of C++.
- Henchman21 5mo agoIts almost like AI is rotting our brains?
- awesome_dude 5mo ago[flagged]
- pdimitar 5mo ago
- deleted 5mo ago[deleted]
- rcxdude 5mo agoHmmm, given the general mood in this case, I feel like there's a lot of people keen to find any criticism of the code they can and amplify it as possible. Most of it strikes me as relatively shallow at the moment, though (that is, apart from the fact that merging such a large LLM assisted port is certainly a, uh _bold_ move (to put it lightly), there's not much that people are pointing out about the actual result that feels like it's worse than any other port in progress, but there is definitely a lot of hay being made about any issue that is found).
- whimsicalism 5mo ago[flagged]
- beepbooptheory 5mo agohttps://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html > Please don't post comments saying that HN is turning into Reddit. It's a semi-noob illusion, as old as the hills.
- whimsicalism 5mo agoI did not say that HN is turning into reddit nor indicate any view on any way in which HN is trending. Remarking that Reddit and HN are similar is not rule breaking, they are both vote systems, etc.
- antonvs 5mo ago> Most of it strikes me as relatively shallow at the moment It is. We’re what, a week into this exercise? Absolutely everyone criticizing it, with no exceptions, is behaving like a micromanaging middle manager who couldn’t even dream of doing the work themselves. I half want to start a list of “people to ignore”, but such people tend to expose themselves in every other comment anyway.
- rajup 5mo ago
- deleted 5mo ago[deleted]
- Aurornis 5mo agoI thought you were going to call out the problem in the other direction: There has not been a "big, flashy announcement" because the port is a work in progress. It's not done or released. The only big flashy announcements I see are these drive-by dunk attempts on the work in progress code combined with attempts to imply that they said it was done or perfect. The rewrite was a code translation meant to be a starting point. > 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). The Bun team never made a big announcement that the code is now memory safe. They've been clear that this is the starting point. Anyone expecting it to be perfect immediately and to have solved all of the memory problems in the original Zig code is arguing with an announcement they imagined, not what the Bun team has said. Did anyone try to map this code back to the original codebase to see if this memory problem exists in the original codebase?
- tonfa 5mo ago> Did anyone try to map this code back to the original codebase to see if this memory problem exists in the original codebase? FWIW what is being discussed is not memory problems, it's breaking rust invariants (the unsafe code has to follow specific rules, e.g. annotate lifetimes properly).
- whimsicalism 5mo agostrongly agreed, all of the flashiness is coming from the detractors. the port itself has been quite lowkey
- poncho_romero 5mo agoBun being a high profile project, that has had visible conflicts with Zig over AI contributions, and was recently purchased by Anthropic, is naturally going to make something like this big and flashy regardless of the author's intentions.
- whimsicalism 5mo ago
- QuadrupleA 5mo agoThe effort required to refute bullshit is an order of magnitude more than to create it.
- stellalo 5mo agoI speculate the real goal is to have that fixed over time, and then use it as precious training data for Rust capabilities
- pesnk 5mo agoThat 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.
- Xylakant 5mo agoThat 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.
- jnwatson 5mo agoIndeed this was caught by a well-known tool, Miri, that detected this error.
- deleted 5mo ago[deleted]
- dralley 5mo ago>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.
- Xylakant 5mo agoIndeed. 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.
- jonas21 5mo agoThis 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.
- stavros 5mo agoUB = undefined behaviour, for anyone else who was puzzled.
- tlarkworthy 5mo agoMaybe 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? ).
- tadfisher 5mo agoIf 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 https://github.com/oven-sh/bun/pull/30728
- nsagent 5mo agoSo this is a clear case where the LLM generated Rust port introduced a bug: > The Zig original is a packed struct with the same shape; it "worked" only because Zig has no reference aliasing or provenance rules to violate. The Rust port inherited the shape without rethinking the API surface.
- jojomodding 5mo agoexactly. If they wanted to iterate on their port they would add lifetime annotations here, which are the tool Rust be uses to ensure safety. They're just kicking the unsafety block down the road. This accomplishes nothing and is not how you get Rust to deliver its safety promise.
- mswphd 5mo agoLifetimes would prevent the particular use-after-free example here, but the UB that miri currently flags would still exist, as it's related to pointer provenance, not lifetimes. https://www.reddit.com/r/rust/comments/1hxjdvp/eli5_what_is_pointer_provenance_and_will_it/ https://www.reddit.com/r/rust/comments/1hxjdvp/eli5_what_is_...
- 5mo ago
- stavros 5mo agoI thought Rust treated undefined behaviour as a compiler bug? Does anyone know what's actually happening here?
- ainar-g 5mo agohttps://doc.rust-lang.org/reference/behavior-considered-undefined.html https://doc.rust-lang.org/reference/behavior-considered-unde...
- ViewTrick1002 5mo agoThey 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.
- quikoa 5mo agoIt 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.
- AlotOfReading 5mo ago"unsafe" is a promise to the compiler that you're going to ensure invariants that the compiler can't check. Rust only promises to eliminate UB if the invariants are held. You can still get UB by violating that promise, as this bug demonstrates.
- tomaytotomato 5mo agoThis 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 but fair play to them having a punt. <Shameless plug> I have been working with Claude code to spec out and bring back to life a Spring Boot starter library for Apache Solr search https://github.com/tomaytotomato/spring-data-solr-lazarus https://github.com/tomaytotomato/spring-data-solr-lazarus There were a few points I had to steer it but the result has been a good implementation.
- mcdonje 5mo agoA souffle has not been made
- tomaytotomato 5mo agoIndeed, more of a frambled egg. Lets see what happens in two years time.
- localhoster 5mo agoDumbest point ever. There is no value for this issue. I don't agree with the way they did the rewrite, but they did the rewrite, and this post contributes nothing, beside making the author seem childish. If it had any real contribution I would have waved it off, but it really doesn't. This tribalism and "I'm better than you"-ism and the same reason everybody hated the stack overflow community, and the rust community as well.
- fgfarben 5mo agoThe issue author is most likely quite literally a child.
- deleted 5mo ago[deleted]
- iamricks 5mo agoThis Bun rewrite feels like a potential Mythos marketing stunt.
- rvz 5mo agoFinally someone gets the point of this.
- applfanboysbgon 5mo ago[flagged]
- pavel_lishin 5mo agoI'm not sure that HN is that influential that buying up a few accounts would matter. To what end?
- applfanboysbgon 5mo agoI think HN has an outsized influence in the industry, for its size. There are a lot of big tech employees and startup founders reading it. Account purchasing absolutely happens, I've discovered and gotten banned at least a dozen years-old accounts that were blatantly sold and puppeteered by bots in the past. The comments aren't obviously bot-written this time around, so I can't conclusively prove it happened in this case, but it is a thing that happens in general and something to be aware of. There's also vote selling to promote things onto the front page. Given how cheap shilling on HN is, and the fact that many will perceive it to be organic while always viewing straightforwards ads skeptically, I wouldn't be surprised if the cost:effectiveness ratio probably beats any other form of advertising.
- sporadicism 5mo agohn appears in google news now
- wiseowise 5mo agoIf you can increase your reach, why not do it? Also, HN has better reputation among tech circles than Reddit and is less niche than other resources. Modern marketing hits everything.
- pohl 5mo agoThis doesn't seem surprising, given the straight translation that they prompted. Couldn't a case be made that it's better to get Bun to the to the language with the stronger type system first and, once there, use that stronger type system as leverage for these kinds of improvements as a follow-on effort? It seems preferable to requiring perfection on the very first step.
- muvlon 5mo agoIt's not surprising that a mostly straightforward translation to (partly unsafe) Rust exhibits UB. What is a bit disappointing is that the Rust code apparently has APIs that aren't marked unsafe but may cause UB anyway. When doing this kind of translation, I'd always err on the side of caution and start by marking all/most things unsafe. Or prompt the slopbots to do the same I guess. Then you can go in and verify the safety of individual bits step by step.
- Kavelach 5mo agoFrom what I read from the PR comments, the case is that the unsafe blocks behave in a way that allows for UB. This is expected, because unsafe rust can leave your program in an unhealthy state, since the language doesn't doesn't hold your hand anymore.
- DSMan195276 5mo agoThe point is that at a minimum you're supposed to bubble the `unsafe` up if the API does not guarantee safety is maintained for all cases (and documents the invariants that have to be kept by the caller), otherwise the system breaks down.
- fastball 5mo agoYes, and seems pretty clear you can now backpressure the rewrite with tools like miri to have Claude Code automatically improve it.
- 5mo ago
- jnwatson 5mo ago"Port of large memory unsafe codebase has a memory safety bug, news at 11." I don't see what the big deal is here.
- RGJorge 5mo ago[flagged]
- Jcampuzano2 5mo agoSo many people are fundamentally misunderstanding everything about this rewrite. In fact using the word "rewrite" itself is pretty inaccurate. As has been mentioned the goal was a port so they "could" eventually rewrite most of it to be idiomatic rust. The main benefit of this now is the compiler and being able to use these tools to fix issues that were already being hidden when it was in zig. If you go into this codebase expecting to see idiomatic rust and get angry when it's not there, you are going in with the entirely incorrect attitude. It's understandable how people see it as AI slop or whatever given the division among developers at the moment. But please see it for what it is instead of just jumping to conclusions.
- deleted 5mo ago[deleted]
- gipp 5mo ago> As has been mentioned the goal was a port so they "could" eventually rewrite most of it to be idiomatic rust. They may have said that, but quite clearly the value they actually get out of it is getting the headline "AI reimplements complex, broadly used software in 2 weeks, but makes it way better because it's rust now" in front of a million people's eyes, only 1% of whom will ever find out it was mostly fluff
- Jcampuzano2 5mo ago> quite clearly the value they actually get out of it is getting the headline This is entirely disingenuous. Jarred has already made it clear what value they get out of moving off of Zig. Yes they used AI heavily to attempt this goal but I don't see what the big issue is. They haven't even released it yet and Anthropic themselves have said 0 about this. The "headlines" thus far are really just people completely uninvolved with Bun and with all to gain by perpetrating "AI BAD". My honest take: the big issue isn't "what if it goes wrong" its the fear that a migration of this size works out of the box and being done almost entirely by AI.
- cptroot 5mo agoMan that issue got way too many comments from non-contributors. I agree that this shouldn't have been merged in in it's current state, but that doesn't mean posting about it on GitHub is a worthwhile way to fix the problem.
- whimsicalism 5mo agoIt is really sad and unfortunate that coding has started falling under the omnicause. Low-denominator discourse is invading every space I find interesting and it is difficult to avoid.
- Hammershaft 5mo agoI agree. I'm as skeptical as many commenters but I also think the degree of polarization in HN around this technology and the degree to which people are calling those with different views shills or naysayers is pretty sad.
- arjie 5mo agoI am having to blacklist a lot of commenters on this site because they are providing misinformation unnecessarily. There's all this garbage about "big flashy announcements" and so on when all the posts are by random people observing an internal detail of an open-source program's VCS or whatever. https://news.ycombinator.com/item?id=48073680 https://news.ycombinator.com/item?id=48073680 (seems like just a normal user - enthusiast at best) https://news.ycombinator.com/item?id=48132488 https://news.ycombinator.com/item?id=48132488 (this one seems suspicious - 2 year old user with this being their only submission ever and they have zero comments - anthropic could have submarined it but it's not a big flashy announcement) https://news.ycombinator.com/item?id=48150900 https://news.ycombinator.com/item?id=48150900 (this thread - user is anti-AI and anti-datacenter) But definitely the one thing these things aren't are big flashy announcement. To be honest, this kind of post-truth environment where people just make up things about people they don't like are super-lame. I've generally been able to deal with it by kill-filing people who post falsehoods but the number of users who do is getting so extraordinarily large I am starting to believe that I need to auto-hide anyone who created an account in the last 10 years.
- whimsicalism 5mo agoHow do you blacklist commenters?
- arjie 5mo ago
- NooneAtAll3 5mo agoSo Bun saga has been "Zig, let me Ai you" "no" *Ai's Zig fork, suffers from memory bugs* "Well I'm moving!" *Ai's code into Rust, suffers from memory bugs*
- whimsicalism 5mo agoSure. I'm completely unaffiliated and think Zig's AI stance is ridiculous & politically-motivated and a port is absolutely justified if they will not budge. Apparently I am deeply in the minority.
- dtj1123 5mo agoPhilosophically motivated, sure. In what way is the Zig foundation's AI stance political?
- whimsicalism 5mo agoI think that we only see these bans because AI has become such a massive political issue in the last year.
- wiseowise 5mo agoDefine “political” when it comes to Zig and AI.
- kelnos 5mo agoYou have to do better than that if you're going to accuse the Zig team specifically of this.
- bigstrat2003 5mo agoThat doesn't pass Occam's razor. The simpler explanation is that the bans exist because people continue to throw slop at open source maintainers, and the maintainers wish to stop such unproductive contributions.
- kristoff_it 5mo ago
- smasher164 5mo agoWhat 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 output would have the same assurances as the input. In this case, I would trust the output even less than the input. The input was memory-unsafe but hand-written. The output is memory-unsafe but also vibe-coded and has had no eyeballs on it. What is the point of abusing agentic AI for this use-case?
- whateveracct 5mo ago[flagged]
- brookst 5mo agoThanks for updating the age-old complaint about the printing press.
- whateveracct 5mo agoi wouldn't say that was as disproportionate
- ModernMech 5mo agoBecause they aren't trying to raise billions of dollars to build a translation tool.
- Animats 5mo ago> "Tbh they could've just hooked up zig translate-c to c2rust". Have you ever seen what comes out of c2rust? It's awful. It relies on a library of functions which emulate unsafe C pointer semantics with unsafe Rust. A few years ago, when I was struggling with bugs in OpenJPEG (a JPEG 2000 decoder), someone tried running it through c2rust. The converted unsafe rust segfaulted at the same place the C code did. It's compatible, but not safe. Main insight: don't do string manipulation in C or unsafe Rust. It's totally the wrong tool for the job.
- mohsen1 5mo agoI was a little shocked that they could get it fully working in a week to be honest. My side project is a very similar ambition (https://tsz.dev https://tsz.dev) but I am in no way claiming success. i keep adding more and more tests to ensure things works. Even after all of TypeScript's own tests pass I am finding bugs which I was totally expecting. The bar for matching tsc's behavior is really _really_ high. see: https://github.com/type-challenges/type-challenges https://github.com/type-challenges/type-challenges I'm not against using LLMs to write a lot of code. But verification should be 100x more robust now that we can output code at this rate.
- tapirl 5mo agoAre there any evidences which prove the process was done in a week?
- cedws 5mo agoI'm stunned that it went from 'this is an experiment' to merging a ~million lines of (likely) unreviewed code in a week. I have nothing against using agents but to rush something like this and leave the community blindsided seems extremely ameteurish. Like something you'd expect a bright eyed graduate engineer to do.
- mohsen1 5mo agotsz for me is an experiment to see how can this kind of work be done better. With a slight difference that tsz is not a direct port and it's a different architecture. I'm also not claiming to have answers but I've learned a ton. A few things that works - Test before code, Bun had lots of test so that's good but maybe they could start by asking Mythos to write like 20k additional tests that pass on Zig Bun first. - Deterministic anti-slop features. LLMs love to solve the problem in the wrong abstraction layer or place. There are many ways to catch this with deterministic tests. I do this in tsz a lot - Roadmap that constantly evolving by humans. - Taking a pause and looking how the progress is going and undoing slop - Fuzztest(https://github.com/google/fuzztest https://github.com/google/fuzztest) style "trying to break things" with the powers of LLM
- 5mo ago
- gpm 5mo agoThis issue is misleading. The issue isn't the existence of undefined behavior that miri would catch. The issue is exposing an API that allows undefined behavior from safe code - which miri only catches if you go write the test that proves it. This isn't an all together unreasonable thing to happen during an initial port of code from an unsafe language. You can, and the bun team seems to be, go around later and make sure that the functions where you wrap unsafe code does so correctly. Temporarily in a porting stage incorrectly marking some unsafe functions as safe isn't a real issue. It's a bit strange to merge it into the main repo in this state, but not a wholly unreasonable thing to do if the team has decided that they're definitely doing this. The only real issue would be if they made an actual release with the code in this state. It's also a bit unfortunate that they didn't immediately set up their tests to run in miri if only because LLMs respond so well to good tests - I know they didn't do this not because of this github issue (which doesn't demonstrate that) but because there's another test [1] that absolutely does invoke undefined behavior that miri would catch. Though the code it's testing doesn't actually appear to be used anywhere so it's not much of a real issue. That said it's obviously early in the porting process... maybe they'll get around to it (or just get rid of all this unsafe code that they don't actually need). [1] https://github.com/oven-sh/bun/blob/4d443e54022ceeadc79adf542b44c50c640e6985/src/bun_core/deprecated.rs#L374-L384 https://github.com/oven-sh/bun/blob/4d443e54022ceeadc79adf54... - the pointers derived from the first mutable references are invalidated by creating a new mutable reference to the same object. In C terms think of "mutable reference" as "restrict reference which a trivial mutation is made through". It's easy to do this properly, derive all the pointers from the same mutable reference, it just wasn't done properly. PS. Spamming github just makes people less likely to work in the open. Please don't. We can all judge this work just fine on third party sites. PPS. And we might want to withhold judgement until it's in a published state. Judging intermediate working states doesn't seem terribly fair or interesting to me.
- theamk 5mo agoOnce project reaches 1.0 for the first time, a lot of people expect that "main" branch is now working all the time. That's what the whole "CI/CD" is about after all - every commit should work. If you are making a full rewrite and have non-working, in-progress code, you use a branch. This way you can still have the working "main", in case there is a security fix needed or something.
- skrrtww 5mo agoI think the only way to interpret a one million line LLM-generated diff with no proper reviews as an employee of Anthropic is that my company no longer has an interest in understanding, or even looking at, its own code. I'd be concerned that by jumping onboard with this sort of development process I'd lose touch with how to engineer software in a detail-oriented or remotely rigorous way. It also makes me question what sort of value the entire Bun project ever had if a drop-in replacement can just be thrown in here like it's nothing. Why do we need all these JS runtimes again? The AI bubble is so large that we've also forgotten how useless and dumb a lot of software engineering labor was even before LLMs came along. We were already in a bubble. All that is to say, I think it's useful to reframe some conversations about AI as, "if AI can accomplish this task, was it ever actually valuable?" I think for some specific things, the answer will be yes, but the tech industry has been huffing its own farts for so long I really don't think anyone has sight anymore of what's economically valuable in a ground truth sense. Much like LLMs themselves, this confusion pollutes the entire well of discourse about their economic utility.
- frumplestlatz 5mo agoStep 1: Vibe-code a buggy, poorly-performing, 500k+ LoC desktop-installed monstrosity in TypeScript to implement a trivial TUI. Proudly note that you’re meeting a 16ms frame budget … for a trivial chat UI. Step 2: Purchase an entire company for a product that, if you squint, might help paper over the entirely predictable problems that arise from using the wrong tools to implement the wrong architecture, because surely the solution isn’t reevaluating your original engineering choices. Step 3: Perform a buggy, vibe-code rewrite of the tool you just bought. A tool you only need because — for whatever internal political reasons — sunk cost means you can only keep digging. Step 4: ???
- CamouflagedKiwi 5mo agoThis was 100% a predictable outcome after Bun was acquired. Of course they were going to do something like this. What would have been significantly better is just rewriting Claude in a language that's actually well suited to what it's doing in the first place (which could well be Rust, Codex is written in it as prior art). It's funny how the vibe coding promoters are keen on things like this, rewriting other codebases as fast as possible with little quality checking, but they are still defensive of their own code.
- quantummagic 5mo agoI'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.
- K0nserv 5mo agoI'm also curious about that. One thing to keep in mind: the invariants you have to uphold in unsafe blocks are quite stringent. I expect that in some instances the Rust code has new UB due to this.
- endospore 5mo agoNo. They introduced quite a few aliasing issues that result in immediate UB in Rust but are allowed in Zig. I skimmed over the unsafe blocks with rg for ten minutes and spotted like 3 cases and these wouldn't exist in the original code. Also the LLM is inventing ways to get around borrow checker limitations with unsafe which is also concerning. But I didn't verify if they are UB or not (either way it's a rejection if I'm to review the code).
- tuetuopay 5mo agoAs for the specific issue: it does not exist in Zig, because Zig does not have ownership. In a nutshell, the LLM created abstractions that allow you to write unsound code in safe rust, which is squarely against the language. To be specific: the abstraction takes a (shared) reference and uses unsafe to wrap it in an owned object, completely erasing le lifetime. In practice, this means users of the abstraction think they own the underlying memory: they choose when to free it. However, it just wraps a pointer that’s owned by someone else (it was a shared reference, remember?), thus it will be freed when you don’t expect it. So why does it not exist in Zig: it’s a false contract about what it is. The Zig pointer is a pointer with no added lifetime information. You can hold a Zig pointer wrong, but you will hold a lying abstraction wrong. You will misuse it because it doesn’t do what’s written on the tin. You will write bugs with it. And, LLMs will too. If they do not have the abstraction definition in their context, they also have no way to know the contract is lying.
- sigbottle 5mo agoSorry wasn't there a post literally like a week ago about this being a long term experimental branch and how we needed to not kick the hatchling while it's an egg? 1 week turnaround I guess is what they meant.
- nicce 5mo agoProbably planned during Anthropic aquization. No way this would happen without their blessings. This is one way to reduce the community noise.
- missingcolours 5mo agoCertainly 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.
- fg137 5mo agoThe kind if code they are writing is probably not what you are using Rust for.
- jadar 5mo ago> Please consider not vibe coding rust as AIs are not good at writing Rust and also hire a real rust dev Isn't the whole point of AI companies using Rust that it's explicit, safe, and AIs are fairly good at writing it?
- minimaxir 5mo agoI suspect "Rust is fast/low memory utilization" is the more common value proposition, with memory safety as the bonus that can push it over other fast languages. Related: If AI writes your code, why use Python? (which notes why Rust has taken off for LLMs) https://news.ycombinator.com/item?id=48100433 https://news.ycombinator.com/item?id=48100433
- chrisco255 5mo agoZig is every bit as fast with typically even lower memory footprint as Rust. The main thing Rust promises that Zig cannot already do natively is memory safety. This is not about Python vs Rust. It is one systems language vs another.
- minimaxir 5mo agoThis Rust rewrite instance is explicitly about memory safety by admission of the devs; I was just commenting on the trend.
- surajrmal 5mo agoNotably the rewrite managed to also both reduce binary size and reduce compile time. Given it's largely a straight non idiomatic migration, that's surprising to me.
- chrisco255 5mo ago-9MB on Win/Linux and unchanged on Mac. It wasn't a 100% pure idiomatic migration there was some cleanup done.
- 5mo ago
- snailmailman 5mo agoThis case is wild and seems to perfectly encapsulate all the problems people complain about with vibecoded projects. The "rewrite it in rust" commit is +1M lines of code. Humans haven't looked at that in depth. In about a week, they saw the tests passed and pushed it to main. Now people have started to look through it and are pointing out glaring issues. And the solution is just going to be "feed it to another AI and ask it to fix it". The entire codebase is slop now. Nobody knows what it does. It manages to pass some tests, but its largely a black box just on the basis of humans haven't read it yet. The code isn't guaranteed to be anything close to 1:1 with the old codebase. Its probably vaguely shaped like the old codebase, but new bugs could be there, old bugs could be there, nobody knows anything yet. Its going to be interesting to see how recoverable this is. They are almost certainly going to just hand every file to an AI, say "look for soundness issues and fix them" and then what? If AI is making huge, sweeping changes to the code so frequently that humans can't keep up, is that really maintainable? The only solution appears to be "even more AI" while anybody that looks closely gets scared away by the too-large-to-comprehend-and-entirely-slop codebase. This kind of thing has been happening with many smaller projects already, but now its a larger project and happening in a much more public way, with the intent to replace human-written, mostly-understood code with slop. I suspect the same thing, with the same problems, is happening inside all the largest companies, just not quite as obviously.
- tempest_ 5mo agoThis is more or less my take on it. I am not against AI code, it can be perfectly fine. The principle issue in my mind is the rate of change. Once you rewrite a code base like this (in a week no less) the only way to work on it in the future is using AI tools because no single person has any knowledge about any specific piece of code base any more. AI generated code that is run through a classic PR process would potentially be fine, but then you sorta lose the entire point of using AI.
- lioeters 5mo ago> only solution appears to be "even more AI" That's the idea, to transform businesses to be wholly dependent on "AI" service to develop software. What better way than to re/write entire codebases until no human being understands it. The Zig project know this, and its so-called "anti-AI" policy is actually pro-community and cultivating human understanding. It's not about the tool or technology, per se, it's about people, knowledge, and sustainability. In contrast, the Bun project is demonstrating how they doesn't care about any of that, YOLO-ing its way to losing the trust of its users, contributors, and maintainers. Oh well, AI will maintain the project now, since no one else can.
- dzonga 5mo agosaid it in another comment [0] - that the whole rewrite thing is just a marketing exercise by LLM merchants to try sell you plebs that their wares "work" [0]: https://news.ycombinator.com/item?id=48078224 https://news.ycombinator.com/item?id=48078224
- 9681722 5mo agoSo a "robobun" clanker responds to the issue and writes a fix (probably just papering over it). This is what Anthropic wants: Let the users do the work, train the fricking bot and claim the credit. If you find a bug, just go straight to blog posts and CVEs to denounce this idiocy. It ranks higher on Google.
- dbmnt 5mo agoThat's not how CVEs work.
- impulser_ 5mo agoWhat do you guys assume that a codebase from an unsafe language containing bindings to another unsafe language would appear perfectly implemented right away?
- Havoc 5mo agoNeat - didn't know about the miri tool. Will definitely use that going forward Didn't find anything on my existing vibecoded rust projects but can't hurt
- unethical_ban 5mo agoMy grandfather was a tailor, and one day a client came in asking for the status of his suit getting clean. My dad as a kid grabbed the unfinished suit and showed the man, who was frustrated at the lack of progress. My grandpa told my dad never to show a client a work in progress - You told them when you'd get the work done, and they can see the finished result when it's ready. It's just a story so don't wrap yourself around the axle with counter-examples. I think it's fair to say that an open-source project going through a language translation is going to have transitional periods as they shake things out, and criticizing every snapshot as some proof that they're incompetent is useless.
- simonreiff 5mo agoHoly cow: architector4@AGOGUS:/tmp$ git clone --depth=1 'https://github.com/oven-sh/bun https://github.com/oven-sh/bun' Cloning into 'bun'... … architector4@AGOGUS:/tmp$ cd bun/ architector4@AGOGUS:/tmp/bun$ find -type f -name '*.rs' -exec grep unsafe {} \; | grep -v '//' | wc -l 13255 ....Thirteen thousand two hundred and fifty five lines without comments with the word "unsafe" in them in Rust code files across this rewrite. This is so gross. I'm a founder of an early-stage startup. I built a precision-editing tool system (called HIC Mouse). It provides coordinate-based addressing, staged batching with atomic rollback, embedded agent guidance, and more. It works well, it's available on VS Code Marketplace, and I've worked for a year and am still grinding every day, working so hard, just to get people to think about trying it, and to get attention paid to it. I did rigorous, careful benchmark research to make sure I wasn't just fooling myself. I incorporated, built a sales pipeline, changed my life by taking a chance and launching a business, and I pound the pavement and toil in obscurity every day and night, trying so hard to get interest in my product. I check every diff painstakingly before committing. I may make tools for AI agents but I am unbelievably careful about reviewing and thoroughly testing their code, and usually rather ruthlessly editing quite a bit further beyond any initial version drafted, long before deciding it is good enough to ship. I take enormous pains to get things right and worry constantly about whether I'm doing enough to make HIC Mouse secure and performant for my users. All I want is to make my users happier and to give them a genuine way to get "surgical, precise edits" that "don't touch the other lines", like we all ask of our AI agents over and over all day if we're using AI. Or maybe not. Here we have Bun. Who cares about 90K GitHub Stars and massive community engagement -- just go crap all over them, all at once, with this AI tripe that you obviously neither tested in any meaningful manner, nor documented, nor read, I am assuming, before merging the whole bloated mess to production. What a disgraceful way to treat your users! I would be so grateful if I had a tiny fraction of the interest in my project that the Bun team has. I could never imagine shipping this garbage in a million years. I'm sorry to vent but this just isn't defensible. It's the very worst of AI. I'm not going to wish ill on Bun, but it just makes me sad that I spend so much effort, work so hard to do things right, and painstakingly review everything because it's not just me any more and I do have folks who depend on my code being reliable and secure. And meanwhile, Bun just gives a huge middle finger to 90k+ starred supporters not to mention the millions of users who didn't click on the star but rely on the library, by acting this disrespectfully and disgracefully towards their own users. How they didn't take one look at this and promptly revert and apologize is simply beyond me. Again, sorry to vent, but this made me irrationally mad.
- 827a 5mo agoAfter this was merged, my company made the decision to migrate everything away from bun and back to node. I don't say this lightly... Jarred is a guy that I held such immense respect for, and its sad to see the course he's charted for a project I spent a lot of time proselytizing internally. Its frankly a betrayal of trust.
- brokencode 5mo agoI thought this was just like a fun proof of concept.. I didn’t realize they actually merged it to main. That seems pretty crazy to me. There’s no way they had time to review the code. This just seems so wildly irresponsible for such an important and high profile project.
- nicce 5mo agoI thought the Zig code is still in main? Both versions?
- reducesuffering 5mo agoWhen it comes down to it, all the vitriol and animosity towards this port is really because of the implication of what its success would mean. If LLM's are capable of completely porting core software modules many people rely on (not just a CRUD app) of 1m lines in a week's time, it is a case closed moment that LLM's are currently much more capable than most people's eng, and can do it much faster. And that's at current capabilities, nevermind where we're headed in 1-3 years. Jarred is an exceptional 1% engineer, and its likely he can succeed at this port, to the detriment of naysayers who don't believe there's any chance it's possible.
- pixelpoet 5mo agoThe comments on that thread are Facebook level cringe. What a dump GitHub has become!
- skywhopper 5mo agoIs this performance art?
- sionisrecur 5mo agoDoes all that UB exists in the Zig version as well? Was it introduced during the port?
- advenn 5mo agoWhen my lead developer refactored my small but crucial python service into golang with Gemini and Claude, I was hesitant to merge the code into master. Yet, my service had, like 20k daily active users. I think they shat over the community who trusted them by trying to advertise their owner company
- gloosx 5mo agoThings get pretty hilarious when you super safe language conrains the keyword "unsafe" :D I wonder what are the real legitimate use-cases for "unsafe" in the first place, it is there for a reason?
- dgacmu 5mo agoMany. Let me give you a very boring example: I use mmap in some of my programs, because it's the easiest/best way to solve the problem I was working on. Mmap is unsafe in rust, because if there are modifications to the backing file it can violate some of rust's assumptions about the behavior of memory not changing unless it was changed by the rust code. In my application I'm able to guarantee that there is no modification to the backing file by making them read-only and ensuring nobody messes with them, but that guarantee exists outside of rust. So -- unsafe with a big SAFETY comment explaining the requirements if you use it. Much rust code will never use unsafe. Systems code is likely to use a bit but also to know what it's doing. Things like this port of bun are unusual and presumably transitory on the way to an implementation with minimal use of unsafe.
- yarn_ 5mo agoMe when I have literally no idea what im talking about
- mawadev 5mo agoRust good zig bad!
- achristmascarl 5mo agoI wonder if the publicity around this AI-driven rewrite will function as a (unintentional, or perhaps intentional) far-reaching nerd snipe that results in Rust developers flocking to the project to identify and fix issues.
- gorjusborg 5mo agoHere's the thing: I was first interested in Bun because it was written in Zig. I was interested in Zig because I respected Andrew Kelley's decision-making, and his taste matched my own. I got really excited about Bun for many reasons after that, but they essentially came down to a similar root: the decisions were ones that I respected and would probably have made myself if I had thought of them. I was a little concerned when Bun was acquired by Anthropic, but forced myself to remain cautiously optimistic. This behavior, though, is exactly the sort of decision-making that I don't respect. I've got nothing against Rust, but if this is how Anthropic is managing Bun, I can no longer bet on it being a reliable part of my toolkit. It isn't just the code, it's the thought behind it that I have to trust. I was so excited by Bun for many of the use-cases I have, but this just turns me off completely. This looks like an Anthropic internal-only tool, based on the behavior.
- pjmlp 5mo agoLike many alternative implementations,I forsee Bun losing the little mindshare it has managed to achieve. I don't have a single reason not to pick nodejs when doing JS.
- kibibu 5mo agoWhat attracted you to Bun over Deno?
- mort96 5mo agoI'm not the person you asked, but for me, it's the package identifiers. Demo puts URLs to web infrastructure in source files, like Go. In my opinion, this is a huge mistake. There should be a mapping from logical package identifier to web infrastructure, and this mapping should happen outside of the source files. I believe in this very strongly.
- ok_dad 5mo agoWhat’s the downside? Go does library versioning very well, IMO, but I like to hear other opinions.
- cube00 5mo agoI'm impressed the Rust runtime even tries to give nice errors about undefined behavior when you've agreed to sign your life away by using 'unsafe'.
- artisin 5mo agoAfter reviewing this rewrite this morning, my only logical conclusion is that it's an elaborate marketing operation orchestrated by a super-secret Deno operative.
- parliament32 5mo ago> oven-sh locked as off topic and limited conversation to collaborators Strong deja-vu about that time Cursor tried to slop together a browser and tried to bury dissent when people pointed out how hilariously terrible the whole thing was.
- teiferer 5mo agoCan somebody explain what the issue is? In particular, if Rust is safe, and this is safe code, then how can there possibly be use-after-free? I thought it's the entire point of the "safe code" thing that it's ..safe by construction.
- gpm 5mo ago> and this is safe code, The code they are complaining about is not safe code, it is unsafe code that exposes a supposedly but not actually safe interface. They demonstrate this by using the interface to get undefined behavior. You can see this rather directly by how miri points to the exact line of unsafe code that results in undefined behavior (which isn't something miri can always do, but it can in this instance).
- teiferer 5mo agoBut how can an interface be considered safe if it actually isn't? I thought the Rust compiler guarantees safety of everything marked a such?
- gpm 5mo agoIt doesn't. The rust compiler exposes a rich type system by which the programmer can make safe abstractions around unsafe code that can't be misused, but it doesn't (and fairly fundamentally can't, thanks to Rice's theorem) verify that people who write unsafe code and purport to have made safe abstractions actually did so.
- andy12_ 5mo agoTo make performant code sometimes requires implementing or using "unsafe" functions (it's not obligatory, and a lot of projects don't use them; but it was probably needed to map Bun's behavior 1 to 1). Those require upholding some invariants that cannot be checked by the compiler. The compiler basically goes "I trust you on this one, programmer. If you fuck this up, unsafe behavior can propagate to the rest of the code".
- Decabytes 5mo agoWhen I was in grad school, my mentor once said, that he didn’t actually see programming as anything more than a tool to solve the problems he needed to solve. As someone who was excited about learning to program, I couldn’t understand it. As I’ve gotten older, I’ve come to understand him more. The language a program is written should be far down the list of reasons to use a programming language. Same with who happens to be the BFDL for the language, or what streamer is using it. What matters more is if it does what you want it to do, and is well maintained.
- areweai 5mo agoWhat I find most concerning about this is the meta-dialogue. At first I was critical of the maintainers for closing this github issue as off topic. Then I realized that the github ui was auto-collapsing a dozen messages in a row that were all completely devoid of any informational value and certainly sourced from forums and community discord channels. This places everyone in a no-win situation. Someone who has identified critical issues that they believe the majority of a relevant community would be concerned about has good reason to signal-boost as much as they can. It's a substantial request about very recent changes, and tone-policing it doesn't make it less true. The problem is that the additional attention literally kills the discussion. This also provides cover for people who may be making more emotive or ai-psychosis influenced decisions on the maintainer side. Projects with a siege mentality which block and ignore criticism tend to go off the rails very quickly. On the other hand, maintainer burnout is inevitable for projects which can't shield maintainers from the anxieties and pathologies of people who seem to think that if they complain about AI enough, everyone else will stop trying to use and improve it it.
- Snafuh 5mo agoThe bun team must love all the people pointing out errors. That's how they get a free, crowd sourced code review of their million lines.
- nicce 5mo agoGood quality issues and then they can just fire up Claude to fix them!
- jgalt212 5mo agoAs a fan of Zig, and knowing that Bun is Zig's highest profile project, I am happy to hear that it wasn't this easy to excise Zig from Bun. I guess they can just hook up the agent to Miri checks and let it grind away, and see what happens.