What Is Rust? Memory Safety Without Garbage Collection
A practical introduction to Rust — where it came from, the three design goals that shape every decision, what it's the right tool for, and what it isn't. With your first Rust program.
What you'll learn
- ✓Where Rust came from and why Mozilla started it
- ✓The three goals that shape every Rust decision: safety, performance, fearless concurrency
- ✓Where Rust fits in modern software — and where it doesn't
- ✓How a Rust program is structured, with a working hello world
Prerequisites
None — this post is self-contained.
Rust is a systems programming language designed to give you the speed of C and C++ without the memory bugs that have plagued those languages for fifty years. It now powers parts of the Linux kernel, the Firefox rendering engine, Cloudflare’s edge, Discord’s backend, parts of Windows, and an ever-growing share of high-performance infrastructure. This post explains what Rust is, why it exists, and when you should reach for it.
No previous Rust experience is assumed.
What is Rust?
Rust is a statically typed, compiled, general-purpose systems programming language. In practice that means:
- Every value has a known type at compile time, checked before your program runs.
- The Rust toolchain compiles your code to a native binary. No virtual machine, no interpreter, no runtime to ship.
- The language is general — web servers, CLIs, kernels, browsers, game engines — but its sweet spot is software where performance and reliability both matter.
The most distinctive feature is memory safety without a garbage collector. Rust catches whole classes of bugs at compile time — dangling pointers, data races, use-after-free, double-free — that other languages catch at runtime or never catch at all.
A complete Rust program looks like this:
fn main() {
println!("Hello, world!");
}
You run it with one command:
cargo run
// output: Hello, world!
That’s the whole surface area you need to start. The rest of this series fills in everything around it.
Where Rust came from
Rust was started in 2006 as a personal project by Graydon Hoare, then an engineer at Mozilla. Mozilla picked it up officially in 2009 because the company had a very specific problem: Firefox’s rendering engine was written in C++, and a meaningful share of every Firefox security advisory came down to memory bugs — use-after-free, buffer overflows, data races between threads.
The bet was that a language designed from day one around memory safety could replace C++ in Firefox without sacrificing performance. That bet paid off. Servo, Mozilla’s experimental engine, eventually fed pieces back into mainline Firefox. Rust 1.0 shipped publicly in May 2015.
Since then Rust has been voted the most-loved language on the Stack Overflow developer survey eight years running. It is now governed by the independent Rust Foundation, with major backing from Google, Microsoft, Amazon, Meta, Huawei, and others.
The three design goals
Almost every decision in Rust traces back to three priorities. Knowing them in advance makes the language much easier to learn — you stop being surprised when the compiler refuses something other languages allow.
1. Memory safety
Rust’s headline feature is the ownership system and the borrow checker that enforces it. Without a garbage collector, the compiler tracks who owns each piece of memory and when it can be freed. We cover the rules in detail in Rust Ownership Basics, but the headline is this: programs that compile in Rust are free from the memory bugs that account for an estimated 70% of security vulnerabilities in C and C++ codebases.
The trade-off is a learning curve. You will fight the borrow checker for the first week or two. After that, the rules become reflex.
2. Zero-cost abstractions
Rust borrows the C++ slogan: what you don’t use, you don’t pay for, and what you do use, you couldn’t hand-code any better. High-level features like iterators, closures, and generics compile down to assembly that matches a careful hand-rolled C version. There is no runtime tax for using nice syntax.
This is why Rust shows up in places where every microsecond counts — databases, game engines, embedded controllers, the Linux kernel.
3. Fearless concurrency
Rust’s ownership rules don’t just prevent memory bugs — they prevent data races at compile time. If two threads try to share mutable state without synchronisation, the compiler refuses the program. That guarantee makes parallel code dramatically less stressful to write.
The phrase the Rust team uses is fearless concurrency: you can hand a junior engineer a multithreaded change and trust the compiler to catch the subtle bugs that would otherwise show up in production three weeks later.
When Rust fits
Rust is the right tool for several categories of software.
Systems software. Operating systems, kernels, drivers, hypervisors, file systems. Rust is now an officially supported language for the Linux kernel and is steadily replacing C and C++ in parts of Windows and Android.
Performance-critical infrastructure. Databases (TiKV, SurrealDB, parts of CockroachDB), search engines (MeiliSearch, Tantivy), message brokers, proxies, build tools. Anything where latency and throughput are first-class concerns.
Command-line tools. Rust binaries are single, static, fast. Modern CLIs like ripgrep, fd, bat, exa, bottom, starship, and uv are Rust programs because they start instantly and use little memory.
WebAssembly. Rust compiles to WASM cleanly and produces small, fast modules. If you need to run high-performance code in a browser, Rust is the strongest option.
Embedded systems. Microcontroller code traditionally written in C is increasingly written in Rust. The lack of a runtime and the compile-time safety guarantees are exactly what embedded engineers want.
When Rust doesn’t fit
Honest defaults matter. Rust is the wrong tool for several common jobs.
Rapid prototypes and one-off scripts. Rust makes you slow down to satisfy the compiler. For a five-minute script that munges a CSV, Python or a shell pipeline will be faster to write and faster to throw away.
Most CRUD web backends. You can build a web API in Rust, and frameworks like Axum and Actix are excellent. But Go, Node, or Django will get you there in a third of the time for a service that mostly forwards JSON to a database.
Machine learning research. Python owns this space. Rust shows up in the inference layer (model servers, tokenisers like Hugging Face’s tokenizers crate) but not in the research notebook.
Game logic at the scripting layer. Rust is excellent for game engines themselves — Bevy is a leading example — but for gameplay scripting, languages like Lua and C# still dominate.
If your problem demands speed, safety, and predictable memory use, Rust is very often the right call.
A first program, dissected
Here’s the hello world again, with every line annotated:
fn main() {
println!("Hello, world!");
}
fn main()— defines the entry point. When you run the binary, the runtime callsmainand exits when it returns.println!— a macro, not a function. The!is what tells you so. Macros expand at compile time and can do things ordinary functions can’t, like accept a variable number of arguments with a format string."Hello, world!"— a string literal of type&str. We cover string types in Variables and Basic Types.
Save it as src/main.rs inside a Cargo project and run it:
cargo run
// output: Hello, world!
That’s the smallest Rust program that does anything. The next post walks through installing the toolchain and creating a real project.
Try this. Don’t install Rust yet — the next post covers that properly. Instead, open play.rust-lang.org, paste the hello world above, and click Run. Then change the message, run again, and try println!("2 + 2 = {}", 2 + 2);. The playground is the fastest way to feel the language before installing anything.
What Rust is like
Borrowing from languages you may know:
- C++ in performance — both compile to fast native code with no runtime in the way.
- ML and Haskell in spirit — algebraic data types, pattern matching, expressions everywhere, strong type inference.
- Go in tooling — one official toolchain (
cargo) that builds, tests, formats, and publishes packages. - Nothing in its ownership system — this part is genuinely new to most programmers.
What it is not: object-oriented in the Java sense. Rust has structs, enums, and traits, but no classes and no inheritance. You compose behaviour with traits, which we will cover later in the series.
Who uses Rust in 2026?
A non-exhaustive list, drawn from public engineering blogs:
- Microsoft — parts of Windows, Azure, and the Hyper-V hypervisor
- Google — Android, Fuchsia, and an officially supported language for Chromium
- Amazon — Firecracker (the VMM behind Lambda), parts of S3
- Cloudflare — Pingora (the proxy replacing nginx at the edge), Workers runtime
- Discord — the read-state and message services, after migrating from Go
- Meta — internal source-control server, build tools
- Linux kernel — officially supported alongside C
- Mozilla — Firefox’s CSS, media, and rendering pipelines
If you are aiming at systems programming, infrastructure, security-sensitive backends, or embedded work, Rust on your CV opens doors that few other languages on this list do.
A common misconception
Rust is sometimes described as “too hard for beginners.” That framing is misleading. Rust is different — its rules are stricter, and the compiler is more involved in your editing loop — but the language has a small surface area and the error messages are unusually helpful.
What’s true is that the early curve is real. You will spend your first week reading borrow-checker errors and asking why the compiler is unhappy. You will also, by the end of that week, have absorbed ideas about memory and concurrency that took the rest of the industry decades to formalise. The investment compounds.
Reflect. Look at one project you’ve shipped in another language. How many of its bugs were memory bugs, null-pointer crashes, or race conditions on shared state? In a Rust version of the same project, the compiler would have flagged each of those before the code ever ran. That is the offer.
A second look at the language feel
Before the timeline, here is what idiomatic Rust looks like in a slightly larger snippet. You don’t need to understand every line yet — the series builds up to it:
fn main() {
let numbers = vec![1, 2, 3, 4, 5];
let doubled: Vec<i32> = numbers
.iter()
.map(|n| n * 2)
.filter(|n| n > &4)
.collect();
println!("{:?}", doubled);
// output: [6, 8, 10]
}
Three things are worth noticing. The closure |n| n * 2 has no type annotations — the compiler infers them. The iterator chain compiles down to a tight loop with no allocation per step. And Vec<i32> is the type spelled out at the binding site because collect needs to know what to build into.
This is the texture of real Rust: small, composable pieces glued together by the iterator protocol, with the compiler quietly proving the whole thing safe.
What a Rust file actually contains
A real Rust source file is more than one function. It typically has, in order:
- A few
usestatements, importing names from the standard library or other crates. structandenumdefinitions for the data types the module works with.implblocks attaching methods to those types.- Free functions, including
mainif this is a binary crate. - A
#[cfg(test)] mod testsblock at the bottom holding the unit tests.
Every file is also a module. The module system uses the directory structure of src/ to organise large projects without ceremony, much like Python’s package layout. You won’t need any of this on day one, but it’s worth knowing the shape ahead of time.
A realistic learning timeline
- Syntax and the compiler’s basic rules: about two weeks of focused study. This series covers it.
- Comfortable with ownership, lifetimes, and traits: two to three months.
- Productive on a real Rust codebase at work: six to nine months. Longer than Go, similar to C++.
- Senior-level idiomatic Rust: two years or more. The depth is real; the type system has corners you will discover slowly.
Rust rewards patience. The compiler is a stern but consistent teacher. Every error message you read carefully teaches you something you will not unlearn.
What you need next
To follow the rest of this series you need:
- A computer running macOS, Linux, or Windows.
- The Rust toolchain installed via
rustup— the next post covers this. - A text editor with Rust support. VS Code with the official
rust-analyzerextension is the most common choice; RustRover from JetBrains is excellent if you want a paid option. - A terminal you are comfortable typing in.
That’s it. There is no framework to pick, no virtual environment to manage. The Rust toolchain handles all of it.
Recap
You now know:
- Rust is a statically typed, compiled language designed at Mozilla to give you the speed of C++ without its memory bugs.
- Its three guiding principles are memory safety without GC, zero-cost abstractions, and fearless concurrency.
- Rust is the right tool for systems software, performance-critical infrastructure, CLIs, WebAssembly, and embedded, and the wrong tool for throwaway scripts and rapid web prototyping.
- A Rust program needs only a
fn main()to run.
Next steps
The next post walks through installing Rust on macOS, Linux, and Windows with rustup, verifying the install, creating a project with cargo new, and running your first program end to end.
→ Next: Install Rust and Run Your First Program
Questions or feedback? Email codeloomdevv@gmail.com.