Remix.run Logo
IncreasePosts 8 hours ago

Why would we need rust, if the AI can just write really good code in C that doesn't exhibit any of the issues that rust protects you from?

Aurornis 8 hours ago | parent | next [-]

Rust's compile-time checks are actually a nice set of guardrails for LLMs.

Nobody who works with LLM generated code believes that LLMs produce fault-free code.

jesseschalken an hour ago | parent [-]

Yes, languages with very strong type systems like Rust are incredible when paired with an LLM. Just like chat bots have a calculator as a "tool" because they are not the best at calculation themselves, they need a type system to deterministically validate the safety and cohesion of the code they generate.

Its languages like C that you have to watch out for, because the LLM will gladly say "this is safe!" when its not.

vmg12 4 hours ago | parent | prev | next [-]

> if the AI can just write really good code in C that doesn't exhibit any of the issues that rust protects you from?

"if"

If it could you wouldn't need to use Rust. It can't, qed.

msy 8 hours ago | parent | prev | next [-]

'rewrite in C, make sure there are no memory leaks'. You first.

IncreasePosts 8 hours ago | parent [-]

Why is that less realistic than saying 'rewrite in rust, make sure there are no memory leaks'?

My point, which I should have been clearer with, is that we aren't at a state where you can just one shot a rewrite of a complex application into another language and expect some sort of free savings. Once we are at that state, and it's good enough to pull it off, why wouldn't the AI be able to pull it off in C as well?

msy 8 hours ago | parent | next [-]

You don't have to trust the AI to do it with Rust, you just have to ensure certain conventions are followed and you can formally prove you're 'safe' from certain classes of issue, no AI magic dice-roll.

A lot of people are very excited by the idea that now language capabilities (and almost every other technical nuance) somehow don't matter but much like gravity they will continue to assert themselves whether you believe in them or not.

So far humans have proven unable to write large apps in C without those issues, given their work is the training basis for LLMs this creates two problems, one being that they don't 'know' what a safe app looks like either and any humans reviewing the outputted code will be unable to validate that either.

throwaway173738 8 hours ago | parent | prev [-]

There are classes of bug that are easy to write in C that are impossible to express in Rust.

davemp 6 hours ago | parent [-]

    let foo = [1, 2, 3];
    unsafe {
        *foo.get_unchecked_mut(4) = 5;
    }
Not sure why Rust evangelists always seem to ignore that unsafe exists.
dendix 5 hours ago | parent | next [-]

Hmmm... where could the oob access possibly be I can't tell

vmg12 4 hours ago | parent | prev [-]

You can prevent unsafe from being used in a repo with linter rules.

throwaway85825 8 hours ago | parent | prev | next [-]

The Rust ecosystem and build tools are much easier to use than C. The value of a language isn't just syntax.

megous 8 hours ago | parent [-]

LLMs are great at C, probably because C is historically the most popular language in the world, by far. It only declined slightly very recently. But there's insane amount of code written in it.

pessimizer 8 hours ago | parent | prev | next [-]

Because it can't?

maplethorpe 8 hours ago | parent | next [-]

Have you tried asking Claude 4.6 Opus?

megous 7 hours ago | parent | prev [-]

Based on a FIDO2 spec I used it to write a reasonably compliant security token implementation that runs on top of Linux USB gadget subsystem (xcept for attestation, because that's completely useless anyway). It also extracted tests from an messy proprietary electron based compliance testsuite that FIDO alliance uses and rewrote them in clean and much more understandable C without a shitton of dependencies that electron mess uses. Without any dependencies but openssl libcrypto, for that matter.

In like 4 hours. (and most of that was me copy pasting things around to feed it reasonable chunks of information, feature by feature)

It also wrote a real-time passive DTLS-SRTP decryptor in C in like 1 hour total based on just the DTLS-SRTP RFC and a sample code of how I write suckless things in C.

I mean people can believe whatever they want. But I believe LLMs can write a reasonably fine C.

I believe that coding LLMs are particularly nice for people who are into C and suckless.

post-it 8 hours ago | parent | prev [-]

It can't, because there is no really good code to train off of.