Learnings from 100K lines of Rust with AI (2025)
zfhuang99.github.io
Learnings from 100K lines of Rust with AI (2025)
1–10 of 225 posts
Re: Learnings from 100K lines of Rust with AI (2025)
#2Re: Learnings from 100K lines of Rust with AI (2025)
#3It's almost guaranteed with agents you could do the same job with less than half of 100k lines. I don't know whats impressive in lines of code generated by agent.
The interesting thing is that it was manageable solo (in many ways it's _more_ manageable solo+AIs than with coworkers+(their)AIs), and in such a short amount of time.
Re: Learnings from 100K lines of Rust with AI (2025)
#4I know LOC is a silly metric, but ~1300 tests for 130k lines averages out to a test per 100 lines - isn't this awfully low for a highly complex piece of code, even discounting the fact that it's vibecoded? 100 LOC can carry a lot of logic for a single test, even for just happy paths.
Re: Learnings from 100K lines of Rust with AI (2025)
#5Re: Learnings from 100K lines of Rust with AI (2025)
#6>Testing is the first layer of defense. My system now includes 1,300+ tests — from unit tests to minimal integration tests (e.g., proposer + acceptor only), all the way to multi-replica full integration tests with injected failures. See the project status. I know LOC is a silly metric, but ~1300 tests for 130k lines averages out to a test per 100 lines - isn't this awfully low for a highly complex piece of code, even…
Re: Learnings from 100K lines of Rust with AI (2025)
#7>Testing is the first layer of defense. My system now includes 1,300+ tests — from unit tests to minimal integration tests (e.g., proposer + acceptor only), all the way to multi-replica full integration tests with injected failures. See the project status. I know LOC is a silly metric, but ~1300 tests for 130k lines averages out to a test per 100 lines - isn't this awfully low for a highly complex piece of code, even…
Re: Learnings from 100K lines of Rust with AI (2025)
#8Is the idea of the runtime contracts similar to the idea of runtime validation? Or are they different in some way?
Re: Learnings from 100K lines of Rust with AI (2025)
#9Honestly, despite all the hype around Rust in the community, the fact that AI can't handle lifetimes reliably makes me reluctant to use it. The AI constantly defaults to spamming .clone() or wrapping things in Rc, completely butchering idiomatic Rust and making the output a pain to work with.
On the other hand, it writes higher-level languages better than I do. For those succeeding with it, how exactly are you configuring or prompting the AI to actually write good, idiomatic Rust
Re: Learnings from 100K lines of Rust with AI (2025)
#10Is the idea of the runtime contracts similar to the idea of runtime validation? Or are they different in some way?
It is described in the "Code Contracts" section of the article: "Code contracts specify preconditions, postconditions, and invariants for critical functions. These contracts are converted into runtime asserts during testing but can be disabled in production builds for performance". The .NET framework article that he links to: https://learn.microsoft.com/en-us/dotnet/framework/debug-tra...