Recent explosion in Rust Rewrites and Reimplementations with LLMs. Thoughts?

Noticed that since the most recent Claude Opus 5.5 module got released there was a massive surge (if you can even call it that) in the amount of games reimplemented or rewritten in Rust.

I understand that most of those people are not Rust developers, and are unlikely to join the community, but this is still an interesting phenomena regardless.

Wanted to hear other people thoughts on that.

Here is one example (among hundreds, if not thousands):

Boy's and their toys.

It surely is a discussion topic that comes back very frequently in this forum, and yes there is a flood of AI generated rust crates or programs for just about anything you can imagine. Maybe the recent version of Claude amplified it but it had been steadily amplifying for at least 9 months now.

Oh, now it is on entirely different level with people rewriting even professional software (including Photoshop!) in Rust.

And kind of succeeding too. (though that "new" Photoshop is not feature complete).

What was happening previously was happening pretty much everywhere, but this new uptick is entirely unique to Rust, hence I wanted to bring that up.

I think its a good exposure for the language even when the rewrite itself is sloppy. It clearly shows that some people prefer to have the project in Rust more then in it's source language even if it means lowering the quality/readability of the codebase.

I'm still trying to work out my opinion on this one:

In general, increased usage is positive for the language. Coupled with project TRACTOR, this leads to both a formal and informal driver for the surge in ports.

I see a huge risk for the language as well: the general quality of the ports is usually terrible. LLMs learn from existing codebases and thus produce an extreme pull towards the average/mediocrity - more LLM generated code means the next generation are trained on even lower quality code-bases.

I also have a lot of concerns about the business practices of most LLM-producing companies and their negative social and ecological impact.

The only way I see to push back against the risk of rust losing its status as a language with overwhelmingly excellent-quality codebases is to provide oracles based on rust's current strengths: compiler output, lints, the various books, guidelines & library documentation. The response to a suggestion like this on IRLO was clear: the overall negative impact of LLMs makes it impossible to obtain consensus for a formal publication of such oracles. I don't see that anything short of formal LLM-targeted guidance as having enough weight to make a difference in the short time available.

So, guess that means my opinion is forming towards: sadly, I think this will be a danger to the language which likely leads to it descending into popularity.

On the other hand if people are going to use LLM to generate huge piles of average/mediocre code I think I would rather they did it in Rust than any other language. Rust is so fussy about types and object lifetimes it gives the LLM a challenge. Surely the result has to be better.

Coding agents can produce code of higher quality than the training data was if they get proper instructions. You need to explain to the agent what high quality means to you and you will get it.

That's not something I would expect in mass-rewrite type of scenario. And, listing off a bunch of good practices does not make it that much better.

Which is sort of the argument I was trying to make. Rust is great at providing proper instructions to humans - which leads to really good quality code vs most other languages.

If we could ensure that the default state for a large portion of the LLM-ports was to use a reasonable set of instructions, then I would feel a lot better about the long-term consequences for the language.

I'm thinking of things like the following, which I've personally experimented with and had reasonable results:

  • an API-design skill based on the API guidelines
  • a documentation skill based on the relevant section of the rustdoc book
  • making use of experimental json output from the compiler and a very strict check replacement
  • a read-the-docs skill leveraging rustdoc experimental json output and a series of indexes
  • an ever-growing collection of clippy::pedantic lints (e.g. forbidding allow_attribute, allow_attributes_without_reason & let_underscore_must_use to force #[expect(unused_must_use, reason = "..."])

but the likelihood of these being pro-actively searched for, found and used is tiny. So how do we get them to be "by default"?

Initially maybe but how long until 98% of rust code just clones everything to avoid lifetime issues and unwraps or ignores all errors:

let x = might_error().unwrap();
let _ = process_might_error(x.clone());

Indeed. I have caught LLM trying to squeeze a couple of unwrap() and expect() in. As bad as that is can be I think its still better than crashing with a segfault or continuing with bad data as one would in other languages. Arguably how errors are handled should be part of ones instructions to LLM. There is no "one true way" to do that.

Surprisingly in my current 8000 line LLM generate project clone() is only used when passing Arc<> around.

I think the bottom line is that LLM can be sneaky we have to keep an eye on them.

If only Rust had a noexcept function qualifier, which would after all optimizations verify that function is unable to panic...

There is a crate no_panic - Rust indeed. Were I requesting a rewrite, I'd ask the agents to use it.

Sadly there isn't an attribute to request a non-diverging function (function that will terminate and will not exit/panic/etc).

In spite of Rust being used, I don't think the phenomenon has anything to do with Rust. It's just another piece of the AI/LLM experimentation/chaos that I'm trying to ignore so I can focus on doing something productive with Rust. (Edit: I'm speaking about myself, no criticism of those using LLMs productively is intended.)

It's why I write AI code in Rust from beginning to avoid Claude's mistake.

A non-terminating function should just be one that returns !, though I'm not super happy with where type unification ended up with on that.

Obviously that attribuite could not exists in Rust. Or in any other programming language that is Turing complete. See Halting problem - Wikipedia.

The idea is, any function where compiler didn't prove termination should fail and let the programmer write an easier function.

It could test for LLVM's auto-set willreturn attribute, and no-panic could check nounwind.

Unfortunately, the usual way to remove panics is to write more unsafe code, which is really not a good tradeoff most of the time. After all, indexing in C++ doesn't panic for out-of-range...

"Hey Claude, rewrite 'rustc' for me in rust."