Loading lesson…
Level 1 · Apprentice0 XP
Every value has one owner; when the owner goes out of scope, the value is freed.
Step 1 / 6
ProblemIn C, two pointers to the same buffer both call free: a crash, or worse, a security hole. In Java, a garbage collector decides later. Rust decides at compile time.
← → step
Before this: Rust basics for Kotlin developers
🛠️ Your turn
Reading is not the skill, doing is. Try for ten minutes before you open the hint. Getting stuck first is what makes the solution stick.
1.Write five small programs that each produce a different ownership compile error (use after move, moved into a function, moved in a loop...). Fix each one twice: once with borrowing and once with clone, and explain which is better.