#ownership
8 articles about ownership
Filter by topic
What is &mut *x (reborrow) in Rust, and why does it freeze the original reference?
A reborrow duplicates the reference, not the data, and freezes the original for its duration. What &mut *x really does.
Mutable vs. immutable borrows: the two rules
The two borrowing rules, why exclusivity is the one that matters, and what the borrow checker actually rejects.
What is the purpose of Box<T> in Rust?
What Box<T> is for, what the extra indirection costs, and when a heap allocation is the right call rather than a reflex.
Why &str Won't Fit &String in Rust: Fun Fixes for String Mismatches!
Why passing a &str where a &String is expected fails to compile, what deref coercion does and doesn't do, and how to fix the mismatch.
How does Rust prevent dangling pointer at compile time?
Why a dangling pointer is a compile error in Rust rather than a crash in production, and how lifetimes make that check possible.
How does ownership prevent memory leaks and data races?
How the ownership rules close off memory leaks and data races before the program ever runs, and where they stop short.
How does Rust ensure memory safety without a garbage collector?
Ownership, borrowing and lifetimes give Rust memory safety at compile time, with no collector and no runtime pauses to budget for.
Rust: Memory Safety Without Garbage Collection
Rust gives you the performance of C with memory safety enforced at compile time. Learn how ownership and borrowing eliminate entire bug classes.