Why learn Rust when an AI can write it?
Ask a coding assistant for a Rust function and you will usually get one that compiles. Ask for a small command-line tool and you may get a whole crate, tests included. It is reasonable to wonder whether learning Rust yourself is still worth the effort.
It is, but the reason has changed. The scarce skill is no longer typing Rust. It is deciding whether a piece of Rust is right.
Compiling is not the bar
Rust’s compiler checks a great deal. In safe Rust it rules out use-after-free, dangling references and data races, and it makes you handle every case of a match. That is a remarkable amount of correctness to get for free, and it is the reason AI-generated Rust is often better than AI-generated code in looser languages.
The compiler cannot tell you whether the design is any good. All of these compile without a murmur:
- a function that clones a vector because borrowing it was awkward
- a parser that calls
unwrap()and takes the whole process down on bad input - a library that reports every failure as a
String, so callers cannot tell one error from another - shared state wrapped in
Arc<Mutex<_>>in code that never leaves one thread
Even cargo clippy with its default settings stays quiet about every item on that list. We checked; the follow-up article has the code.
None of these is a crash today. Each is a cost someone pays later: an allocation in a hot path, an outage caused by one malformed line in a config file, an error that cannot be handled because it cannot be identified. An assistant produces them because they make the compiler stop complaining, and stopping the complaints is what it was asked to do.
Someone still has to approve it
When an assistant writes code, a person still decides whether it ships. That person needs to answer questions that no tool answers for them:
- Does this function need to own its argument, or would a borrow say more about what it does?
- Can a caller handle this error, or only print it?
- Is this lifetime annotation necessary, or a workaround for a design problem one level up?
- Is this
Arc<Mutex<T>>protecting anything?
You can only answer those if you understand ownership, borrowing, error types and API boundaries well enough to picture the alternative. Without that understanding, reviewing AI-written Rust means skimming it and trusting the green tick, and the green tick only proves that the compiler is satisfied.
Rust is a good language to learn this way
Learning with an assistant at your elbow is risky in most languages, because it is hard to check what the assistant tells you. Rust is different. The compiler, the test suite and clippy give definite answers. If an assistant claims a borrow is fine, you can find out in seconds. If it claims a change is safe, the tests can say otherwise.
That makes a useful order of authority:
- the code
- the compiler
- the tests
clippyandrustfmt- the official Rust documentation
- human review
- AI output, once it has been verified
An assistant may still be the quickest route to an idea. It is just not the final word on whether the idea is right.
What to practise instead
If judgement is the scarce skill, practise judgement. In practice that means spending less time memorising syntax and more time on:
- Repairing. Take code that does not compile, or compiles badly, and fix it without reaching for
.clone()orunwrap(). - Predicting. Before you run the compiler, decide whether the code will compile and what the error will be. Then check.
- Explaining. Write two sentences on why your fix is correct. If you cannot, you have not finished.
- Reviewing. Read plausible but flawed code, including code an assistant wrote, and make specific, testable review comments.
- Challenging. When an assistant gives you an answer, find the command that would prove it wrong.
None of this is new. It is how people have always learned to program well. What has changed is that the routine part, producing a first draft, now costs almost nothing. The rest of the job is worth more than it was.
Where Rust Primer fits
Rust Primer is built around that loop: compile it, test it, explain it, verify it. It is for people who can already program. Each module pairs a short reading with an exercise in a local Cargo crate with failing tests, an explanation to write, and a drill in which you question an AI assistant’s answer rather than accept it. The course page lists the modules.
Who this is for
If you want to understand the Rust your tools produce, and to get better code out of them, you are in the right place. Knowing what good Rust looks like is what lets you ask an assistant for it, and notice when you have not got it.
If all you need is code that runs, and you are content to trust whatever compiles, that is a reasonable choice for plenty of software. Rust Primer is not trying to change your mind, and you would probably find it hard work for little reward.
The course is in private alpha. The article feed is the best way to hear when it opens up.