263
ownership
also borrow checker, Rust lifetimes
One owner. Borrows are temporary. Cloning to silence the checker keeps the cost forever.
What is ownership?
Ownership means each value has one owner, and it is dropped when the owner ends. A borrow is a shared or a mutable reference, not both, and it must not outlive the value. The borrow checker rejects use-after-free. A lifetime is part of the type. unsafe is you promising the checker’s rules still hold.
Why does ownership matter when vibe coding?
The draft clones every argument, or it wraps everything in Rc and RefCell, or it adds an unsafe block so the error goes away. The program compiles and the aliasing bug is back.
How do you do ownership?
Own data in the struct that keeps it. Borrow for the length of the call. Clone only when a second owner is the point. Do not use unsafe to pass the compiler.
How do you ask a model for ownership?
Fix the ownership error in (function) without cloning by default and without unsafe. Borrow (value) for the call. Store it only if this struct should own it. Do not wrap it in Rc to silence the checker.
What goes wrong with ownership?
A lifetime annotation copied from the error until it compiles. The annotation is now a lie about how long the data lives.