Remix.run Logo
kibwen a day 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.

veidr a day ago | parent | next [-]

No, and there's been a lot of confusion about that on this website.

They did cite Rust's safety as a motivating factor for the port. That doesn't imply trying to achieve that simultaneously with the language change — which is good, because that would be insane. (Or, if you prefer, even more insane.)

You cannot faithfully port a codebase to a new language while also radically re-architecting it. You have to choose.

They want the safety benefits of Rust going forward; i.e., after it's finished, when they then write new code in Rust.

swiftcoder a day ago | parent [-]

Yeah, exactly. The typical approach is to do a mechanical translation such as with rust2c, that is full of unsafe, and then gradually refactor safety in.

Dylan16807 a day ago | parent [-]

But nobody makes announcements and blog posts about running that.

pgporada a day ago | parent | next [-]

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

Dylan16807 a day ago | parent [-]

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.

Ar-Curunir a day ago | parent | prev [-]

And indeed, the bun team has not done that

Dylan16807 a day ago | parent [-]

Did they not make the announcement? And they definitely promised a blog post even if it's not out yet.

Ar-Curunir a day ago | parent [-]

Not on their blog, website, or twitter, so no?

dathinab a day ago | parent | prev | next [-]

> Did they even claim it was "memory-safe"?

they didn't,

actually the port is trying to be mostly 1:1 and in turn is mostly unsafe rust, which means no benefits initially

but also doing the 1:1 port to mostly unsafe rust is also only the first step of a full port, you then incrementally go through it fixing issues and remove "unsafe" usage. (And long term likely also doing some refactoring to using more idiomatic rust, but that has less priority).

The problem is there was no blog port describing the whole thing to someone without contextual knowledge. Instead just linked PRs which is in this case somewhat close to a "as if nearly all people only read the HN headline" case :/

Like a more context giving version of the first HN post would have something on the line of `Show HN: Bun is porting to safe rust (PR link), starting with an AI based automatized port to mostly unsafe rust which once it behaves mostly the same as Bun in the test suite will likely be merged. But must be followed up with incremental PRs to remove unsafeness, and likely also a lot of unsoundness related to the way it's ported (some explanation about why this port will have unsoundness).`

parchley a day ago | parent | prev | next [-]

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

Anon1096 a day ago | parent [-]

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 years reading threads about the Rust port of Bun these are the exact same arguments we see from people advocating continued use of C++.

defen a day ago | parent | next [-]

> Assuming the port is actually 1:1 without any behavioral changes, these bugs already exist in the Zig code

The "1:1" assumption is a massive unjustified assumption. Rust and Zig have different memory models, so it's possible to do a "1:1" translation of Zig code to Rust and end up with undefined behavior in Rust.

For example, Zig code might make assumptions about lifetimes based on implicit knowledge of which allocator was used for some memory. That could cause problems in Rust if you erase the lifetime https://github.com/oven-sh/bun/blob/main/src/bun_core/string...

DSMan195276 a day ago | parent | prev | next [-]

> Assuming the port is actually 1:1 without any behavioral changes

It's not, that's clear from this kind of bug popping up. Functionally this bug exists because `PathString` was converted into a "safe" Rust API but still works the same internally as the original Zig code did (via using `unsafe`), that introduces UB that wasn't there in the Zig code.

If it was attempting to be a 1:1 with no behavior changes (like c2Rust attempts to do) then this would not have been turned into a "safe" Rust API like this.

Henchman21 a day ago | parent | prev | next [-]

Its almost like AI is rotting our brains?

awesome_dude a day ago | parent | prev [-]

[flagged]

Xylakant a day ago | parent | next [-]

Quite to the contrary to what you write, many people pushing for Rust explicitly recommend to be very restrictive about touching existing, battle tested code and only rewrite it if you're substantially refactoring it anyways, or if it is a critical exposed piece of functionality - such as media codecs for example, which have a long history of being broken. The winning strategy that for example the google android team pursues is to not rewrite existing code, but write all new code in Rust, because real-world data shows that vulnerabilities in existing code follow a decay curve - most issues are detected in the early life of the code. That's the strategy that Firefox uses, too. (Though I'm curious about how LLMs change that equation because detecting errors in rarely used code path' seems to be what they're doing well)

And indeed, this is very much what Rust was designed to do with the ability to interface with existing C/C++ code in both directions. So this is the strategy that the designers of the language had in mind from the early days. It's a deliberate choice to offer this, and not an emergent property that was later discovered.

awesome_dude a day ago | parent [-]

> many people pushing for Rust

You have couched this correctly, because we all know there are people out there who do go around yelling "Rewrite it in X" without thought (where X is the flavour of the month)

I also wanted to say - your description of the /right/ way to align a project with tech X is a restatement of Martin Fowler's "Strangler pattern"

Can you edit your post - "equation because deteting errors" is ambiguous - deleting, or detecting - I cannot work out which you mean

Xylakant a day ago | parent [-]

> equation because deteting errors

should be

> equation because detecting errors

Thanks for the catch, did the edit.

pdimitar a day ago | parent | prev [-]

And yet, all I ever see are attacks against these convenient bogeymen with artistic exaggerations like yours... but I never see the bogeymen themselves.

awesome_dude a day ago | parent [-]

You've never seen the Rust evangelists?

I am genuinely jealous.

Also, I know you made a typo, but it did make me laugh

Bogeymen is what you meant

Boogymen reminds me of the joke in Millenium Man (How do you make a handkerchief dance - put a little boogie in it)

pdimitar a day ago | parent | next [-]

I actually have not, for real. And I keep getting beaten up here on HN just for daring to say it.

Makes you think who is who in this situation. Bullies screaming they are the victims.

LexiMax a day ago | parent | next [-]

The only time I've ever seen anything that could be considered Rust evangelist is when someone with a chip on their shoulder shoves a github issue or random comment link in my face. I certainly don't encounter them in the wild.

awesome_dude a day ago | parent [-]

You're right - Rust has never had tech evangelists, absolutely never

In fact it's the only technology known to humans to never have had any such thing.

Puhleease.

LexiMax 21 hours ago | parent [-]

I'm not saying they don't exist. I'm saying that I don't encounter them in the wild. Certainly nowhere near as often as I encounter people who have a loud and obnoxious dislike of Rust.

What I'm trying to say is that if you see Rust evangelists everywhere, your label is either so wide-ranging as to be useless or you need to rm your rust_evangelist_evidence.txt because it's likely taking up a disproportionate amount of headspace.

awesome_dude 19 hours ago | parent [-]

No.

Your claim was clear - only people anti Rust show up in your mentions - and your own logic points out that that's because of your attitude wrt Rust.

Nothing else justifies (not that your position is justified) jumping in as a cheerleader for the other poster

You're backtracking now because you've realised the folly of your claim, and how disingenous it was for you to make the claim.

LexiMax 8 hours ago | parent [-]

I'm confused. Where do you think I'm backtracking?

awesome_dude a day ago | parent | prev [-]

A quick scan of your comment history suggests that you see one every day ;)

And - the number of times I have been grossly downvoted for daring to utter a true word about Rust (or even Rust adjacent) will let you know your non-existent Rust evangelists are indeed the bullies - with one now screaming that he is a victim.

If you want definitive proof - look at this sub thread where you're so triggered that people talk about the mere existence of Rust evangelists (and evangelists exist for every tech - they always have and always will - which you would know given your [claimed] history in the field) that you want to argue they they aren't evangelists, they're just poor misunderstood victims.

Note: I say claimed not as a jab but because I don't know you and can only go on your claims in your profile.

pdimitar a day ago | parent [-]

My comment history? The very same one that keeps trying to extract out the location of those supposed Rust zealots and never even getting a single response except yesterday... and the linked comment was pretty mild? But I always get downvoted for having the gall to ask? That comment history?

Surely you mistyped that part of your comment with the one I wrote above, right? Understandable.

I guess we'll have to agree that we live in parallel realities though, reading your comment -- which I do find genuinely puzzling. Because I keep not seeing evangelists and the only one using troll-like language here is you, not me ("triggered", really?).

I am looking at the sub-thread. I guess I need new glasses. Still not seeing anyone fanatical / zealot or whatever. What I see are people who try to ground a discussion because a top comment happily tears down a straw man, and those comments are attempting to show that.

> Note: I say claimed not as a jab

Oh, I am sure. Your comment absolutely cannot be mistook for that.

awesome_dude a day ago | parent [-]

Just a final post

"No true Scotsman" detected

and

>> Note: I say claimed not as a jab

> Oh, I am sure. Your comment absolutely cannot be mistook for that.

I made an explicit note because I suspected that you were going to take it as such (and, as demonstrated by the sarcasm in your response, you did)

Have a nice day bud - nobody has changed their mind - it's been real.

pdimitar a day ago | parent [-]

You are reaching and trying too hard to find bogeymen where they don't exist, that's my conclusion.

Be more awesome, dude. :)

pdimitar a day ago | parent | prev [-]

Also yeah, serves me right for trusting my phone's keyboard. :(

Editing the comment out now, thanks for pointing out the typos!

lucideer a day ago | parent | prev | next [-]

They didn't need to - much of the popular hype around rust is on the back of uninformed spectators confusing Rust's tools for enabling memory-safety (good, warranting hype) with Rust itself guaranteeing automatic memory safety (fantasy).

CamouflagedKiwi a day ago | parent | prev | next [-]

They didn't have to. There's a widely held assumption that Rust == safe, or safer than anything else.

pornel a day ago | parent [-]

What exactly people mean by "safe(r)" makes all the difference.

It's simply not possible to include all the nuance of safety of a language and all software written in it a single word. This leads to all kinds of miscommunication and strawmanning.

Rust's official line is specific memory safety guarantees, with caveats that it must not be broken by unsafe code, the OS, compiler bugs may happen, etc. Rust also has a bunch of best-effort features that steer users towards more robust code, but can't guarantee it.

This gets twisted in both directions:

- people ignore the caveats and limitations, pretending that Rust promised zero bugs ever, and use any bug in any Rust program as a proof by contradiction that Rust's claims are false.

- or focus solely on the caveats, ignoring all the advancements and incremental improvements, and take a "then why even bother?" There are classes of bugs Rust can't stop. Nothing is foolproof for a sufficiently advanced fool, and an infallible programmer could write bug-free code in any language, which creates a false equivalence between languages.

scuff3d a day ago | parent | prev [-]

[dead]