Enables Interior Mutability for Copy types - the inner value is never shared, only copied in and out.

let c = Cell::new(5);
c.set(10);
let x = c.get(); // copies the value out
  • No &T into the interior is ever given - Cell could change the value while the reference exists, breaking borrow checker guarantees
  • Only works if T: Copy - without it, there is no way to access the value without giving a reference
  • Zero Runtime overhead

RefCell solves this differently by sharing a tracked reference at Runtime.