Seventy percent. That's the share of Microsoft's security vulnerabilities over the past decade that trace back to memory safety bugs — the same class of bug that has plagued C and C++ since the 1970s. Buffer overflows, use-after-free errors, dangling pointers. Not logic mistakes. Not bad algorithms. Just the language letting you do things you shouldn't be able to do.
Rust fixes this. Not by adding a garbage collector that slows your program down. Not by adding runtime checks that catch the bug after it happens. Rust makes the entire class of memory errors impossible to compile in the first place. Your program either passes the compiler's memory safety checks, or it doesn't build. There is no in-between.
That's a bold claim. Rust backs it up. It's now in the Linux kernel, the Windows kernel, AWS infrastructure, Cloudflare's network stack, and Discord's backend. It topped the Stack Overflow developer survey's "most loved" (now "most admired") ranking every year from 2016 through 2025. And it manages all of this while matching C and C++ in raw performance.
It's also a good moment to start: on November 12, 2026, Rust shipped version 1.100 — a hundred releases past 1.0, on a six-week cadence that hasn't broken your old code since 1.0.
This is your complete introduction to Rust.
C gives you total control over memory. You allocate it, you free it, and if you get any of that wrong — freeing memory twice, reading memory after freeing it, writing past the end of a buffer — you get a bug. Sometimes a crash. Sometimes corrupted data. Sometimes a security vulnerability that ships to production and gets exploited a decade later.
The traditional solutions all have tradeoffs. Garbage collection (Java, Go, Python) solves the problem automatically but introduces pauses and overhead — unacceptable for systems code, kernels, and real-time applications. Manual discipline (C, C++) keeps performance but relies entirely on programmer vigilance, and programmers are human.
Graydon Hoare started Rust as a personal project in 2006 (Mozilla began sponsoring it in 2009) with a different idea: what if the compiler itself enforced memory safety, at compile time, with zero runtime cost? The result shipped as Rust 1.0 in 2015 and is now governed by the independent Rust Foundation, with Microsoft, Google, Amazon, Meta, and Mozilla as members.
Rust installs through rustup, the official toolchain manager. It handles the compiler, the standard library, and Cargo — Rust's built-in package manager and build tool.
macOS and Linux:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
Windows: Download and run rustup-init.exe from rustup.rs. You'll also need the Microsoft C++ Build Tools if you don't have Visual Studio installed.
Verify installation:
rustc --version
cargo --version
Once installed, create your first project:
cargo new hello-rust
cd hello-rust
cargo run
Cargo creates the project structure, compiles it, and runs it in one command. You'll see "Hello, world!" — and you're off.
Open src/main.rs. It already contains:
fn main() {
println!("Hello, world!");
}
A few things to notice immediately: fn declares a function, main is the entry point, and println! has an exclamation mark — that means it's a macro, not a regular function. Rust macros are powerful and you'll see them often. Run it with cargo run.
In Rust, variables are immutable by default. This is one of the first things that surprises people coming from other languages:
fn main() {
let x = 5;
// x = 6; // compiler error: cannot assign twice to immutable variable
let mut y = 5; // mut makes it mutable
y = 6; // fine
println!("y is {y}");
}
This isn't just a style choice. Immutability by default means the compiler can make stronger guarantees about your code's behavior, and it makes concurrent programming dramatically safer. You opt in to mutability rather than opting out of it.
Everything interesting about Rust flows from one concept: ownership. Every value in Rust has exactly one owner. When the owner goes out of scope, the value is automatically freed — no garbage collector, no manual free(), no runtime overhead.
fn main() {
let s1 = String::from("hello");
let s2 = s1; // s1 is MOVED to s2
// println!("{s1}"); // compiler error: s1 was moved
println!("{s2}"); // fine
}
This is called a move. When you assign s1 to s2, ownership transfers. s1 is no longer valid. The compiler enforces this. There is no way to accidentally use memory that's been freed because the compiler won't let you compile code that tries.
To use a value in two places without transferring ownership, you borrow it:
fn print_length(s: &String) { // & means "borrow a reference"
println!("Length: {}", s.len());
}
fn main() {
let s = String::from("hello");
print_length(&s); // lend s to the function
println!("{s}"); // s is still valid here
}
The & creates a reference. The function borrows the value, uses it, and returns it when done. The owner (s in main) is never invalidated. The borrow checker tracks all of this at compile time — no runtime cost whatsoever.
One honest footnote: Rust has an escape hatch. Code marked unsafe lets you do the raw-pointer tricks the compiler normally forbids — it's how Rust talks to hardware and C libraries. The guarantees in this article apply to safe Rust, which is the overwhelming majority of real code; unsafe blocks are small, clearly labeled, and easy to audit.
Rust uses structs for custom data types. Methods are defined in a separate impl block:
struct Rectangle {
width: f64,
height: f64,
}
impl Rectangle {
fn area(&self) -> f64 {
self.width * self.height
}
fn is_square(&self) -> bool {
self.width == self.height
}
}
fn main() {
let rect = Rectangle { width: 10.0, height: 5.0 };
println!("Area: {}", rect.area());
println!("Square: {}", rect.is_square());
}
&self means the method borrows the struct — it can read it but won't consume or modify it. If you need to modify the struct, use &mut self. If you want to consume it entirely, use self. The compiler enforces whichever contract you declare.
Rust's enums are far more powerful than enums in most languages. They can carry data, and the match statement forces you to handle every case:
enum Direction {
North,
South,
East,
West,
}
fn describe(dir: Direction) -> &'static str {
match dir {
Direction::North => "heading north",
Direction::South => "heading south",
Direction::East => "heading east",
Direction::West => "heading west",
}
}
If you add a new variant to Direction and forget to handle it in a match, the compiler refuses to build. Not a warning — an error. This eliminates an entire category of runtime bugs where a new case silently falls through unhandled.
Rust has no null. None. Instead, the possibility of a missing value is represented explicitly with Option<T>:
fn find_user(id: u32) -> Option<String> {
if id == 1 {
Some(String::from("Alice"))
} else {
None // no user found
}
}
fn main() {
match find_user(1) {
Some(name) => println!("Found: {name}"),
None => println!("No user found"),
}
}
Errors work the same way with Result<T, E>:
use std::num::ParseIntError;
fn parse_age(s: &str) -> Result<u32, ParseIntError> {
s.trim().parse::<u32>()
}
fn main() {
match parse_age("42") {
Ok(age) => println!("Age: {age}"),
Err(e) => println!("Parse error: {e}"),
}
}
The compiler forces you to handle both the success and failure cases. You cannot accidentally ignore an error in Rust the way you can in C or Java. The ? operator makes this ergonomic for functions that propagate errors:
fn load_and_parse(s: &str) -> Result<u32, ParseIntError> {
let age = s.trim().parse::<u32>()?; // returns early on error
Ok(age)
}
Cargo deserves its own mention. It handles dependencies, building, testing, documentation generation, and publishing to crates.io — Rust's package registry with over 200,000 packages.
Add a dependency in Cargo.toml:
[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
Run cargo build and Cargo downloads, compiles, and links everything. No Makefiles, no CMake, no manual include paths. For a systems language, the developer experience is shockingly pleasant.
Run your test suite:
cargo test
Generate and open documentation for your project and all its dependencies:
cargo doc --open
The adoption list reads like a tour of the most demanding software in the world:
Linux kernel — Rust support was merged in Linux 6.1 at the end of 2022 as an experiment. At the December 2025 Maintainers Summit the kernel developers declared the experiment over: Rust is now a permanent, core part of the kernel alongside C.
Windows kernel — Microsoft is writing new kernel components in Rust, citing the 70% CVE statistic as the primary motivation.
AWS — Firecracker, the microVM technology powering AWS Lambda and Fargate, is written entirely in Rust. So is Bottlerocket, their container-optimized Linux distribution.
Cloudflare — Pingora, the Rust proxy framework that replaced NGINX across their network, handles a huge share of their traffic with a fraction of the CPU and memory.
Discord — Famously rewrote their Go service in Rust (their "Read States" service, which tracks which messages you've read) and eliminated the latency spikes Go's garbage collector caused every couple of minutes.
WebAssembly — Rust is the most popular language for compiling to WASM, making it the go-to choice for high-performance browser code.
Honestly — yes, at first. The borrow checker rejects code that would work fine in other languages, and the error messages (while excellent) introduce concepts most developers have never encountered. Plan for a few weeks before it clicks.
But here's what nobody tells you: the borrow checker is teaching you something real. The bugs it prevents are bugs you've been writing your whole career without realizing it. Once ownership and borrowing click, you'll start seeing memory hazards in your other code that you never noticed before.
The Stack Overflow survey doesn't ask "is Rust easy" — it asks "do you want to keep using it." A decade running, developers who learn Rust don't want to go back.
Rust forces you to think carefully about memory — not to make your life harder, but because careless memory management is the source of most security vulnerabilities in systems software. The compiler is strict because the alternatives are CVEs, crashes, and exploits.
What you get in return is a language that is simultaneously as fast as C, as expressive as modern high-level languages, and — outside of clearly marked unsafe blocks — incapable of the memory bugs that have haunted the industry for fifty years. Microsoft, Amazon, Google, and the Linux kernel maintainers have all reached the same conclusion: for new systems code, Rust is worth it.
The learning curve is real. The payoff is realer.
Tell us what you learned from this article, or what you liked about it. We read every comment.
Know someone who'd love it too?