Using GPT 4o to Learn Rust
Learning has always been a favorite pastime of mine. In university I spent a lot of time learning about OpenGL and how to build game engines. I find learning something just for the sake of exercising your brain to be hugely rewarding.
To that end, I decided to pick up a new programming language: Rust.
Why Rust?
Bluntly, I want to level up my systems programming game. I have spent some of my career writing C++ for various game engines and computer vision projects. But I don’t feel that I have a strong foundation in systems programming languages. I sat on the side lines and admired a lot of the early performance gains that were made possible by languages like Rust for foundational components of LLMs like tokenizers and embeddings.
So, I want to learn Rust — and potentially use it to build some fast, performant components for my own projects; both personal and professional.
But whenever I want to learn a new language, I like to start by trying to rebuild something that I’ve made before. And to this end, my goal with learning Rust is to build a voxel-based game like Minecraft in Rust. Doing so allows me to easily connect the dots with concepts that I have already spent time learning, whilst also learning the ropes of a new language.
That’s how I found Bevy.
So the goal is simple
- Learn the fundamentals of Rust
- Learn Bevy
- Build a voxel-based game like Minecraft
How To Learn?
The most obvious answer is to read the language reference and follow along with the official Rust book. But that’s dry as hell, and not very fun. If I go down that path then I know that my attention will be short-lived.
Well, it’s 2025. So let’s use AI to act as my tutor.
Here’s the full conversation in case you’re interested.
Using AI As a Tutor
The prompt is simple.
Teach me rust. Introduce one concept at a time, ask me a few questions to check my understanding before moving on.
Now, 4o starts to walk me through the fundamentals of Rust. Covering one concept at a time.
Concept 1: Variables and Mutability
In Rust, variables are immutable by default. That means once you assign a value to a variable, you can’t change it unless you explicitly say it’s mut (short for mutable).
Example:
let x = 5; // Immutable // x = 6; // This would cause a compile-time error! let mut y = 5; // Mutable y = 6; // This is allowedKey points:
letcreates a variable.mutallows it to be changed.- Rust encourages immutability for safer and more predictable code.
Quick Check:
- What keyword do you use to make a variable mutable in Rust?
- What happens if you try to change a variable without mut?
- Why do you think Rust makes variables immutable by default?
Answer these, and if you’re good, we’ll move to Concept 2!
Then I can simply respond with Mut, error, safety, and the AI checks my
understanding and moves to the next concept.
Perfect — exactly right:
mutfor mutability.- Changing an immutable variable causes a compile-time error.
- Immutability improves safety and predictability. You’re tracking really well.
Now you might be thinking, “Isn’t this just regurgitation of the language reference or some other tutorial?”.
And you’d be 100% right. Of course it is. But unlike the language reference, this is a conversation. And a conversation that I am in control of.
Don’t understand something, have the AI give you some more examples. Think you get it, but want to check — ask the AI. Maybe the pacing of the tutorial is just painfully slow. I get how to define variables and how control flow works. Sure, but teach me the language specifics.
Well, with AI you control the speed.
Some times the AI would share a concept with me and ask questions — but I get it. I don’t need to learn this topic. So I just tell my tutor “Go next, I get it.”
Speed and Depth
Using AI as a tutor to me just making learning a new topic more fun. I am able to control the speed of new information, go deeper into certain topics as I need and even draw analogies to topics I already know.
Within less than an hour I was able to cover the fundamentals of Rust, and all the content of the official Rust book.
Modalities
Rather than just sitting there and reading the language reference, or iterating on code, I am able to use a bunch of different modalities to learn with the AI.
Some times I write back to the AI. Sometimes I write code in my IDE and share it using the local MacOS app integration with Windsurf.
So times I’d send an audio message. Or if I am really lost, I would start a real time voice chat with the AI and iteratively work through a problem.
To me, this goes beyond a tutorial. It’s now a conversation. I have a world class tutor, experienced in everything, with infinite patience at my fingertips.
Where Things Break
So learning Rust was going well. I had the fundamentals down. Time to dive into Bevy.
This is where things fell apart. And the issue here is missing context. You see Bevy is a relatively new framework. And because of that, it’s in constant flux. That means that when 4o started walking me through the basics of Bevy, it “hallucinated” a bunch of API that just wasn’t there anymore.
SpriteBundle just didn’t exist — Bevy had decided to refactor there design and
because of 4o’s knowledge cuttoff, it didn’t know. This meant that I spent more
of my time debugging the missing API than I did just following what my AI tutor
was trying to teach me. That’s not to say that this wasn’t actually a good
learning experience, but it was a bit of a bummer.
I had to end up referring to the Bevy documentation to get unstuck, and feeding the new context back to my AI tutor.
Conclusion
Learning Rust was a fun experience. I was able to learn the fundamentals of the language and get a good grip on the language specifics.
I also got a taste of what it’s like to learn a new language with the help of AI. I will continue to explore using AI in this Tutor-style to learn other topics as well.
Perhaps with some more context, the AI would have been able to help me with the Bevy learning experience. I may explore exporting the Bevy docs and feeding that into 4o to see if the results as significantly better.
I was still able to piece together a fun little Conway’s Game of Life game in Bevy with the help of the AI tutor.
Next Steps
I plan to continue learning Rust and Bevy. I will continue to use AI as a tutor and see how far I can get with creating a voxel based game over the coming weeks.
As always, get busy building.
Marcel van Workum