- Published on
Rust: the language that solves memory safety without a garbage collector
- Blog

- Henrico Piubello
- Henrico Piubello
- IT Specialist - Grupo Voitto
IT Specialist - Grupo Voitto
- What is Rust and what problem does it solve?
- How do ownership and the borrow checker work?
- Rust vs C++ vs Go: when should you pick each?
- Where is Rust already used in production?
- What are Rust's real downsides?
- How do you start learning Rust?
Rust answers an old dilemma: until it came along, you could have execution speed or memory safety, not both. The language moves verification to compile time and delivers fast binaries with no garbage collector and none of the classic C failure modes.
What is Rust and what problem does it solve?
Rust is a compiled, general-purpose language created at Mozilla by Graydon Hoare and stabilized in 2015. Its stated goal is to enable systems programming — the layer where operating systems, databases and browsers live — without paying that layer's historical price: memory bugs.
The problem is measurable. Microsoft and Google reported, in independent analyses of their own codebases, that around 70% of serious security vulnerabilities originate in memory management failures — out-of-bounds reads, use after free, null pointers. These are errors that languages like C and C++ permit by design and that depend entirely on the discipline of whoever writes the code.
Garbage-collected languages — Java, Go, C#, Python — solve this by outsourcing memory to a runtime process. It works, but it costs: unpredictable pauses, higher RAM consumption and one less layer of control. For an ordinary web service, a great deal; for a driver, a kernel or a rendering engine, unacceptable.
Rust picks a third path: prove at compile time that the program does not commit those errors. If the proof fails, the binary is not produced.
Practical example: in C, returning a pointer to a local variable is an error that compiles, runs and fails randomly months later. In Rust, the compiler identifies that the reference would outlive the data and rejects compilation with an explanation of why.
How do ownership and the borrow checker work?
Three rules underpin the entire memory model:
- Every value has exactly one owner.
- There can only be one owner at a time — assigning to another variable moves ownership.
- When the owner goes out of scope, the value is dropped and the memory freed.
To use a value without transferring ownership, you borrow it by reference. And that brings in the rule behind the language's reputation for difficulty: at any given moment you can have either several immutable references or a single mutable reference. Never both.
fn main() {
let name = String::from("CodeCrush");
let length = measure(&name); // immutable borrow
println!("{} has {} characters", name, length); // name is still valid
let mut list = vec![1, 2, 3];
let first = &list[0]; // immutable borrow
// list.push(4); // ERROR: mutable borrow while an immutable one is live
println!("first = {}", first);
}
fn measure(text: &str) -> usize {
text.len()
}
That restriction feels bureaucratic until you see what it buys: if only one mutable reference exists at a time, data races between threads are impossible by construction. It is not a convention or a best practice — it is a property verified by the compiler. That is why the community talks about fearless concurrency: parallelizing in Rust does not carry the anxiety of discovering a concurrency bug in production.
Practical example: Firefox rewrote its CSS engine in Rust (the Stylo project) precisely to parallelize style computation. Earlier attempts in C++ were abandoned over race risk; with the borrow checker, the parallelization was verified at compile time.
Rust vs C++ vs Go: when should you pick each?
The three compete for space in systems and infrastructure, with distinct trade-offs:
| Criterion | Rust | C++ | Go |
|---|---|---|---|
| Memory safety | Guaranteed at compile time | Programmer's responsibility | Guaranteed by garbage collector |
| Garbage collector | No | No | Yes |
| Latency predictability | High | High | Medium (GC pauses) |
| Learning curve | Steep | Steep | Gentle |
| Compile time | Slow | Slow | Very fast |
| Concurrency | Verified by the compiler | Manual | Goroutines, simple |
| Ecosystem | Young and growing | Vast and mature | Mature in backend |
The choice becomes clear once you name the priority. If the requirement is predictable latency with safety — trading, drivers, databases, embedded — Rust. If the requirement is productivity in network services, Go delivers more useful code per hour. If the requirement is integrating with a decades-old ecosystem — game engines, scientific computing, CUDA — C++ remains unbeatable.
Practical example: Discord migrated a read-state service from Go to Rust in 2020 and documented the reason: garbage collector pauses created latency spikes every couple of minutes. In Rust, without a GC, the spikes disappeared and memory consumption dropped.
Where is Rust already used in production?
Adoption has left the niche and entered the infrastructure that sustains the web:
- Operating systems. Rust was accepted into the Linux kernel starting with version 6.1 (2022) for driver development, and Microsoft rewrote Windows components — including parts of the graphics font handling in the kernel — in Rust.
- Cloud infrastructure. AWS uses Rust in Firecracker, the hypervisor behind Lambda and Fargate. Cloudflare wrote Pingora, the proxy that replaced NGINX across much of its network.
- Developer tooling. A large share of the new generation of JavaScript tooling is Rust underneath: SWC, Turbopack, Rspack, Biome and the uv package manager for Python.
- WebAssembly. Rust has the best Wasm support of any language, allowing high-performance code to run in the browser — from video editors to game engines.
- Embedded and IoT. Support for
no_stdallows Rust on microcontrollers, a space historically exclusive to C — relevant for anyone working with embedded systems.
The common denominator: contexts where a memory failure is too expensive, whether in security or in availability.
Practical example: Android began incorporating Rust in new components from 2021. Google reported that between 2019 and 2024, the share of memory vulnerabilities in the system fell from 76% to 24% — without rewriting old code, simply by writing the new code in safe languages.
What are Rust's real downsides?
Four costs show up consistently in adoption reports:
- Steep learning curve. The borrow checker rejects patterns that work in other languages — doubly linked lists, cyclic graphs, circular references — and requires learning specific tools (
Rc,RefCell, explicit lifetimes) to express them. The first months are low-productivity. - Compile times. Large projects compile slowly. Mitigations exist (incremental compilation,
cargo check, alternative linkers), but the friction is real in the development cycle. - A younger ecosystem. crates.io has more than 190,000 packages, yet in specific domains — scientific computing, machine learning, integration with corporate legacy systems — the catalog still trails Python, Java and C++.
- A smaller job market. Demand exists, is generally well paid and concentrates in infrastructure, blockchain and critical systems. But the volume of roles is far from JavaScript or Java, which matters for anyone choosing a first programming language.
Practical example: a team used to Python estimated two weeks to port a file-processing service to Rust. It took six — four of them arguing with the compiler about lifetimes. The final service was 40 times faster, but the original estimate ignored the cost of learning.
How do you start learning Rust?
An efficient path, in the order that saves the most frustration:
- Install with rustup and use Cargo from day one.
cargohandles builds, dependencies, tests and formatting — the tooling experience is one of the language's strongest points. - Read "The Rust Programming Language" (the Book). It is free, official and probably the best introductory book for any language. Do the chapter 4 exercises (ownership) slowly; everything else depends on them.
- Practice with Rustlings. Small exercises that fail to compile and ask for a fix. It teaches you to read compiler messages, which are exceptionally good and explain causes rather than symptoms.
- Write a real CLI. A tool you would actually use — batch renaming files, parsing logs. With the
clapandserdecrates, the result is useful and the scope stays small. - Only then tackle concurrency and async.
tokio,async/awaitand advanced traits make far more sense once ownership has become intuition.
One tip changes the experience: treat compiler errors as code review, not as obstacles. Almost always the message describes exactly the conceptual problem and suggests the fix — and the lesson usually applies to code you write in any other language.
Practical example: a developer who swapped "I will read the whole book before coding" for "I read one chapter and apply it in a CLI" was writing useful code by the second week. The order matters more than the volume of study.
Conclusion
Rust is not a better language at everything — it is a language that makes one specific, explicit trade: more effort while writing in exchange for eliminating, by construction, an entire class of failures that costs dearly in production. Where that trade pays off — operating systems, network infrastructure, databases, embedded, high-performance tooling — it has already won the argument, and its presence in the Linux kernel, in Windows and at the base of AWS is the evidence. Where it does not pay off — CRUD apps, prototypes, scripts, products still searching for market fit — insisting on Rust means paying a cost without receiving the benefit. If you work close to the metal or want to genuinely understand how memory works, the two-to-three-month investment to fluency repays itself; and the understanding the borrow checker forces on you stays with you even when you go back to another language.
## faq
Frequently asked questions
What is the Rust language?
Rust is a compiled, general-purpose language focused on systems programming, created by Graydon Hoare at Mozilla and released as stable in 2015. It combines performance comparable to C and C++ with memory safety guarantees verified by the compiler, without needing a garbage collector.
What is ownership in Rust?
It is the system of value ownership: each value has exactly one owner, and when the owner goes out of scope, the memory is freed automatically. Values can be moved to another owner or borrowed by reference, and the compiler verifies these rules before producing the binary — which is why there are no leaks from forgetting to free and no access to already-freed memory.
Is Rust better than C++?
On memory safety, yes: Rust eliminates at compile time errors that in C++ depend on programmer discipline and external tooling. On ecosystem maturity, compile times, GPU support and availability of professionals, C++ still has the edge. The choice depends on how much a memory failure costs in your context.
Is Rust hard to learn?
It is harder than average, for one specific reason: the borrow checker rejects code that would compile in other languages, forcing you to make lifetimes and ownership explicit from the start. People coming from garbage-collected languages usually need two to three months to reach fluency. The upside is that errors which would surface in production surface at compile time instead.
What is Rust used for in practice?
Operating systems and drivers, command-line tools, database engines, network infrastructure, WebAssembly, embedded systems and performance-critical components inside applications written in other languages. Much of the modern JavaScript tooling — SWC, Turbopack and their peers — is written in Rust.
Is Rust worth learning in 2026?
It is worth it if you work with systems, infrastructure, performance or security, or if you want to deeply understand memory management — the learning improves your code in any language. It is not worth it if the goal is entering the job market faster: the roles exist, but they are fewer and more specialized than those for Python, JavaScript or Java.
Topics in this article
## continue lendo
Artigos relacionados
Keep browsing
Previous article

Kubernetes: the practical guide to container orchestration
Kubernetes orchestrates containers at scale: how the control plane works, the essential objects, when to adopt it and when it is unnecessary weight.
Read moreNext article

Next.js: the React framework for production applications
Next.js solves routing, rendering and caching for React. See the App Router, Server Components, rendering strategies and when it is not worth it.
Read moreAbout the author



