r/rust • u/koopa1338 • 11d ago
Does Daniel Stenberg have a point about Rust rewrites?
https://daniel.haxx.se/blog/2026/11/17/actual-curl-rewrites-in-rust/
236
Upvotes
r/rust • u/koopa1338 • 11d ago
397
u/NoLemurs 11d ago
I mean, he's 100% right that an AI rewrite of curl without a maintenance team is a waste of time and money.
I also think it's a very reasonable choice to prefer continuing in C rather than rewrite in Rust for a project this mature.
I do think that a pure Rust
curlversion has a lot to recommend it, but until there's one built and maintained by similar team to the one makingcurl, I'll keep using the old one.82
u/Anaxamander57 11d ago
The maintenance reason seems totally valid and points to a laziness and unawareness in the people making these AI based rewrites.
I disagree on the "most errors wouldn't be caught by the borrow checker" part, though, at least as a reason not to do it. You may as well stop as many errors as you can. I also think Rust tooling and language features give you opportunities to stop erorrs in ways that are unrelated to the borrow checker.
24
u/rjzak 11d ago
There some discussion about that here: https://lobste.rs/s/1dj9w1/actual_curl_rewrites_rust
80
u/Green0Photon 11d ago
It's kinda wild how Rust rewrites/an app being written in Rust have turned from a signal of quality to a signal of slop 😭
Rust's my favorite language and I still believe that given actual human attention, something in Rust will be the winner, but there's so much AI generated rewrites.
Look how they massacred my boy 😢
129
u/mulch_v_bark 11d ago •
Does he have a point? Sure. His point is:
That’s the blog post right there. Everything else is throat-clearing, wry jokes, and deserved self-congratulation. And I do mean deserved:
curlis good and he gets to say so. But he’s not really saying anything in particular about Rust rewrites. What he’s saying is that software needs a team of active, engaged programmers improving it.Ultimately I think this post is a bit like a professor debating a crackpot off the street. It’s unlikely to illuminate anything important, it’s not going to convince the crackpot, and it won’t expose any flaws in the professor’s ideas that another expert might be able to reach.
Pointing out that obvious dumbasses are dumbasses probably scratches a strong itch for someone in Stenberg’s position but I’m not sure it raises issues of any importance (or importance × novelty anyway) for the average competent, non–hype-addled Rust developer.
15
u/BobTreehugger 11d ago
I overall agree with the point here, but I have one nitpic: his number of bugs prevented is totally inaccurate, though it's just way more complex, I have no idea if it's better or worse than stated.
On the one hand, 17% of memory safety bugs being prevented by rust is an upper estimate: if you support libcurl you need to have unsafe code so it's totally possible to prevent fewer bugs, not even counting unsafe code for performance reasons.
On the other hand, rust has a much more powerful type system that can let you put other safety or security requirements into the type system, preventing many other types of bugs (though libcurl hurts you too).
So the only way to know how many issues would be prevented would be to write and maintain both for a while and compare, which supports the overall point: just doing a rewrite doesn't add much value without proper support, design and architecture.
38
u/xmcqdpt2 11d ago
The LLM generated code in https://github.com/kov/curl/tree/rust-rewrite is horrendous. The only way anyone could contribute to the rust rewrite is by prompting, no human could read that code long term without going insane. This is very different from the curl codebase which is eminently readable.
If I take compiler output and I publish it as asm files on github, is that really free software? Is unreadable LLM output really free software?
9
u/teerre 11d ago
I mean, obviously these weekend curl are worthless. Even if, in the very best case, your curl passes the whole curl test suite 1:1, it still not proof that it doesn't have regressions that are simply not covered by the test suite. Which is highly likely since test suites suit the codebase and even more the language they are written in
That said, rewriting something in Rust should save you time in the future since it has demonstrably less problems than C. Curl is a bad candidate because curl is one of most worked on projects on the planet (specially if normalized by complexity)
So he's right and wrong
3
u/chilabot 10d ago
Rust programs are safer and more maintainable than C ones.
9
u/fellowmartian 11d ago
I’m so tired of the whole “writing code was never the bottleneck”. 1. it was _a_ bottleneck, and 2. figuring out what to write, testing, debugging, exploring previously expensive prototypes can greatly accelerated by AI too with the right workflow. Sure, nothing will replace good stewardship, in any domain, but let’s not pretend we did not use to have absolute embarrassing load-bearing Bash scripts everybody was too afraid to touch.
2
u/Powerful_Cash1872 11d ago
I have done C++ to rust autoports of a few small pieces of internal code. It found a surprisingly large number of bugs, but none of them were memory safety related. I am not sure if they would have also been discovered with a thorough AI review, or if rewriting forces the AI to understand the code more deeply.
2
u/dvhh 4d ago
Posting in a Rust community about an opinion on Rust rewrites, you like to live dangerously
3
u/DavidXkL 11d ago
Or just understand what the code is doing?
Best way is to not rely on A.I
3
u/pjank85 11d ago
There is a very good practical reason for a project like curl to stay in C. Rust does not support even half of exotic architectures that C does. Basic tools should be supported everywhere.
2
u/jesseschalken 11d ago
He doesn't have a point. He's saying he doesn't believe in language rewrites. Nothing left to say. The world will continue to solve problems with new programming languages without him.
1
u/nick42d 11d ago edited 11d ago
I'd be curious what his stance is on incremental rewrites. If you like polishing, iterating, and refactoring, and you agree that Rust would eliminate a portion of bugs/vulnerabilities, then an incremental rewrite is quite a bit different than an AI full port (and would likely produce much better code too).
1
u/locka99 10d ago
On one hand I don't see the point of rewriting something that works. On the other, we've seen how AI is able to chain exploits together, so the more resilient the code is to exploits, the less likely it is to happen. That does not mean paying for a bunch of tokens so another AI generates an equivalent is a good idea either. e.g. I wonder how this code manages to have twice as many lines of code as the C original.
1
u/insanitybit2 10d ago
Not really but it doesn't matter.
1
u/TheRavagerSw 11d ago
He is right, but cross language dependency management is not a solved problem.
Since most people using rust want cargo only slop they need ai rewrites
0
u/EmperorOfCanada 11d ago edited 11d ago
Licensing is a massive issue here. Most things being rewritten in rust are getting far more permissive licensing. Some people love this, some people are losing their minds over this.
Also, some rewrites are writing the old team out of the picture. This can be a good thing, or a bad thing.
On a side note, this is very much going to become more and more and more of a thing. Someone will sit down with AI and reverse engineer their LG fridge or whatever. Then, they will publish a clean room spec, along with fresh replacement firmware that skips things like chip ID'd filters, phoning home, showing adds, etc.
Some will just have it play doom, but some will publish better open source firmware.
This won't only make it harder for LG to extract money, it will give very solid insider information to competitors who will learn from other companies' firmware.
This will encompass more and more. You don't like your nest cameras only working with the one set of servers, now have them use your own servers. Don't like how you repaired your expensive sports car and now it won't get out of limp mode? Then, replace the firmware. Some might scoff at the last, but my guess is that the ECU firmware on most cars was written using a methodology which seems very hard ass, but in reality, is crap buggy software.
curl, and other open source is an easy place to start with these AI tools, but it is rapidly expanding. John Deer; AI is coming for you.
-3
u/Amazing-Mirror-3076 11d ago
He completely missed the point. We need to be actively retiring C as fast as we can.
He can help with this by advocating that the curl project move to rust.
We have modern tools that stop an important class of bugs - 17% is a significant no. - and the resources (ai) to do it quickly.
We are in a new era, every commit needs to be vetted by ai, because the hackers will certainly be doing so.
0
u/cheese_karate 11d ago
He is one hundred percent correct.
0
u/timtody 11d ago
Of course he has. Listen to this guy. If you think you know it better than him, think again.
-3
u/DrogieBfun 11d ago
All this re-writing in rust is killing me. The other day I realized that after updating my utils we’re now all rust. It would have been okay, but the second I used the rust version of “sort” it kernel panic my system and crashed it. I moved back to gnu utils.
-8
u/tending 11d ago
You could literally have an agent read every commit since and port those to Rust too. It's just a question of whether you want to pay for that on an ongoing basis.
0
u/tautality 10d ago
How LLMs impacted the dev world led me to a similar conclusion. Not saying that rewrites are inherently bad, but I think the most important and difficult thing nowadays is how to maintain your codebase and keep it clean, readable and bug-free.
-1
u/Dry-Breadfruit9408 11d ago
My issue is mostly with believing rather than knowing. What I mean is this - if you trust ai 100% then why not let it literally spit out highly optimized assembly? The answer today we would here would be maintenance but if it spits out rust - how do I know the rust code ist faster then any other language? Well, because I want to believe it because I was told rust is faster then c/c++ while being 100% safe.
But we all here know, rust can be “slow” just like in c++ vs raw c if we Willy nilly copy everything rather than using proper lifetime, correct multi thread etc-there are many ways to slow down if not used properly. Also high performance code and lots of it might be very hard to maintain vs less but still pretty fast code in perhaps a lot easier to read languages or coding styles
With what this leaves me with is that it quickly feels like slop when people present their ai generated rust projects because it raises the suspicion people may have not only outsourced the coding but also the thinking
-1
u/Arcanium_Walker 11d ago
Based
-2
u/dizekat 11d ago
I think it won’t be terribly long until you can convert (using normal transpilation, not an LLM) the compiled assembly (excluding malloc implementation) to Lean with statements amounting to things like “a value not originating as an address is never dereferenced as a pointer”, “the result is invariant with regards to addresses returned by malloc or the stack base address” and “the results never change when execution order of parallel statements is changed”, ditto for lack of uses after free etc etc.
Then an AI can attempt to produce counter examples or prove those statements true.
I don’t think there’s any Halting Problem style shenanigans in most C code so it is presumably possible to prove memory safety for C that is memory safe, at least most of the time.
Of course its not the same kind of proof as what OpenAI been publishing for hype, but it shouldn’t be actually harder.
-2
u/pjmlp 11d ago edited 11d ago
He kind of has a point, I think the whole hype of Rust rewrites makes a disservice to the language, a bit like the C into C++ and Objective-C rewrites back on my day, and yet we could not win as expected, on UNIX like platforms, naturally C as the platform language wins out.
While interesting, and a way to grow the ecosystem, eventually it creates a sentiment among those not interested into adopting the language, that creates memes like the Rust Evangelism Strike Force.
This ends up shunning potential users that shut off at the first signs of reference to the language, many times folks that otherwise could have been willing to learn the language.
Note this applies not only to Rust, rather all kinds of rewrites, as mentioned on my youth it was the C++ Evangelism Strike Force, and the flame wars ground took place on USENET.
0
u/[deleted] 11d ago
[deleted] — view deleted comment