KNOWLEDGE
In the age of vibe coding, why has Rust risen?
The trend changed, and Rust rose with it. With vibe coding (using the code AI writes as is, barely reading it), code pours out, but not all of it works. Errors and trial and error pile up accordingly, and so does their cost, even when that cost is not money.
When you press the final 'build' button (compile), Rust checks strictly for errors. That saves the cost and prevents errors ahead of time.
Seen as an automated line
In a handmade factory, some inspection happened while things were being made. When an automated line took over, products poured out, and with that small inspection gone, defects became a new problem. Even when inspectors are rushed in at the back of the line, there is simply too much pouring out to check it all.
Rust is a language with a strong automatic inspection module at the end of the line. That is how it prevents this problem ahead of time.
Source: Andrej Karpathy named vibe coding in February 2025. The DORA 2024 report estimated that as AI adoption increased, delivery stability (such as the share of deployments that need fixing right after release) fell by 7.2%.
Same defect, two lines
Pick a defect and a line, then run it. Switch the line (language) and the place where the defect is caught changes.
- ProductionThe AI writes the codeWaiting
- End-of-line inspection= the compilerPython: syntax onlyWaiting
- Inspectors at the back= human review and testsThis example: a common input the AI pickedWaiting
- Shipping= in the user's handsThis example: a rare inputWaiting
- Production with a small check= people write code themselves and check as they go
- Inspectors at the back= human review and tests
- Shipping= in the user's hands
Press Automated line to run the AI-made code yourself.
missing_buggy.pyThe AI's first version
def find_email(users, name): for u in users: if u["name"] == name: return u["email"] def greeting(users, name): email = find_email(users, name) return "mail: " + email.lower()
What was printedPython 3.11.4
Press Run to go through the four boxes in turn.
Source: the four examples were written by an AI (Claude) for this page, with the mistakes put in on purpose. The output on screen is what Python 3.11.4 and rustc 1.100.0 actually printed. A few lines of long output are cut to ….
One line per step
- Write (production)The examples are code in which the AI got only the common case right and missed the rare case (a name not in the list, a list with two short words in a row).
- Check (end-of-line inspection)Python looks only at the syntax and runs right away. Rust also checks types and borrowing rules, and builds no program if they are broken. The borrowing rules say that while a value is lent out to be changed, nothing else may borrow it.
- Test and real input (back-end inspection and shipping)In Python, both examples pass the test, and the defect shows up only on real input. ① stops with an error; ② gives a wrong answer with no error.
- Fix (back to the line)rustc says which line is not allowed and why, and for both examples it also added a way to fix it (help). Give this error back to the AI and it can write the next version. In a 2023 study, GPT-4 repeated this loop and made 134 of 182 real GitHub commits from popular Rust libraries compile again.
Source: the loop is from Deligiannis et al. (2023), section 2.2; the 134/182 commits (73.63%) are the GPT-4 result in table 3 (best of five answers, N = 5). The commits were found in the GitHub history of the top 100 libraries on crates.io.
Frequently asked questions
What is vibe coding?
Telling an AI what you want in words and using the code it writes as is, barely reading it. Andrej Karpathy first used the name on X in February 2025 for coding where you forget the code even exists and accept all of the AI's changes.
Do errors really grow when AI writes code?
The DORA 2024 report (Google Cloud) estimated that as AI adoption increased, delivery throughput fell by 1.5% and delivery stability by 7.2%. Stability is measured by metrics such as the share of deployments that need fixing right after release. These are estimates based on a survey.
Why does Rust suit AI coding?
The Rust compiler checks types and borrowing rules before the code runs, and when they are broken it gives an error with the line number and the reason. In this page's two examples, rustc 1.100.0 rejected both mistakes before running and also added a way to fix them (help). In Python 3.11.4, the same mistakes got past the test and showed up only on real input.
Does letting AI fix code from compile errors actually work?
Microsoft Research's RustAssistant (2023) gave the compiler's error to an LLM together with the code, applied the fix, and compiled again, over and over. With GPT-4 it made 134 of 182 commits with compile errors (73.63%), found in the GitHub history of 100 popular Rust libraries, compile again. These are results for 2023 models.
Can't Python catch the same mistakes ahead of time?
By default, Python looks only at the syntax and runs. The type checker mypy rejects using a value that may be None without checking it, but it checks only functions with type hints (mypy documentation). Without hints, as in this page's Python examples, it does not check them by default.
What mistakes can't the Rust compiler catch?
Mistakes that break no type or borrowing rule. The Rust book says the type system cannot catch everything, and gives the example of a function that should add 2 but adds 10. Tests have to catch logic errors like that.
Further reading
- P. Deligiannis, A. Lal, N. Mehrotra, A. Rastogi, Fixing Rust Compilation Errors using LLMs (arXiv 2308.05177, 2023)
- Google Cloud, Announcing the 2024 DORA report (2024)
- A. Karpathy, vibe coding (X, 2025-02)
- S. Willison, Not all AI-assisted programming is vibe coding (but vibe coding rocks) (2025)
- The Rust Programming Language, 11. Writing Automated Tests
- Rust error codes: E0599
- Rust error codes: E0502
- mypy documentation: Optional types and the None type
- mypy documentation: Dynamic vs static typing