RsRust · Lesson 3 of 8
Ownership & Borrowing
This is the chapter that makes people close their laptop and go for a walk. But it's also the chapter that makes Rust special. Take it slow.
Every value in Rust has exactly one owner. When the owner goes out of scope, the value is dropped (freed). No garbage collector. No manual free(). This is Rust's entire memory safety story.
References let you use a value without taking ownership. A reference is like a pointer, but the borrow checker guarantees it's always valid — no dangling pointers ever.
◆ Note
The borrow checker operates at compile time with zero runtime cost. If your code compiles, memory safety is guaranteed. If it doesn't compile, the error messages will tell you exactly what the problem is (usually).
The borrow checker operates at compile time with zero runtime cost. If your code compiles, memory safety is guaranteed. If it doesn't compile, the error messages will tell you exactly what the problem is (usually).