r/learnrust • u/AdmirableStructure16 • 19h ago
Rust
Serious question...
Is it just me or has Rust become the default programming language of AI's? I know its lightweight and extremely fast in terms of run/consume, but whatever project i see, be it for a game server or anything else, always Rust. It wasnt like this before. Been in the run for a long time (10+ years) and i can confidently say that people DID NOT like Rust at that time because it was so hard to understand and it felt like a joke language to them (They were also saying that about PHP, lol)
Give me your opinion. Am i hallucinating?
26
u/NeonVoidx 19h ago
the lsp and compiler errors and warnings are vastly superior to other languages which makes AI much better with that over something like idk C++
13
u/Tr0ll-Craft 19h ago
AI love statically typed languages and thrive in feedback. The compiler overhead of Rust provides both those things with a fail fast, with thorough feedback loop. I dont think it is a training thing, it could be a developer driven preference.
6
u/elfennani 19h ago
I think it's solely because the compiler can tell the agent exactly what and where the fault is in the code.
3
u/MornwindShoma 19h ago
The most hilarious thing is when people like DHH hated Rust because "woke" and now they're all in love with it.
1
u/UhLittleLessDum 17h ago
Yes. Yes you are. Rust has been one of the favorite languages among developers in every stackoverflow poll for years now.
1
u/StephenRoylance 15h ago
for me, its the error handling. AI can sometimes write code like errors don't happen, in rust, that's almost impossible.
1
u/Ka1kin 15h ago
The additional static safety that has always been Rust's strength makes reviewing AI written Rust much easier than, say, C++. Bugs are certainly possible, but they usually arise from logic errors that are apparent from a close reading of code and its tests.
Rust's complexity is not a barrier for AI. The borrow checker is all up-side. Combined with the runtime efficiency of the compiled code and a really solid toolchain with good dependency management, it's hard to not want to have your agents write Rust.
1
u/scadoshi 27m ago
AI is non-deterministic but very fast at writing code. The more structure you can give it to be able to check its results the better. The Rust compiler just so happens to do this for free
And unlike humans, AI won't complain about fighting the compiler. It will just follow the strict rules it's given and produce banging applications (with plenty of human guidance still of course; if it compiles it's safe but doesn't necessarily mean it's right but you already know this prolly)
-1
u/AnArmoredPony 19h ago
yes it is basically Claude (Programming language) at this point
-1
u/Goprrrrr 19h ago
Rust is popular for being blazing fast, and many project have been ported to rust because some devs try to achieve a better performance or whatever. These ports give models clear patterns to do the same and help them to extrapolate concepts from other projects.
Also rust compiler is good for agentic loops, since they can guide an AI until fix the remaining errors.
-1
u/EarlMarshal 18h ago
Rust was still growing in the past and closed a lot of milestones in the last years.