Reborrowing is an automatic coercion where the compiler creates a new, temporary reference from an existing one to satisfy a function's expected type without moving the original reference.
fn takes_mut(x: &mut i32) {}
fn main() {
let mut val = 5;
let ref1 = &mut val;
let ref2 = &mut val;
// Reborrowing happens here: ref1 is not moved, a new &mut is created
takes_mut(ref1);
takes_mut(ref1); // ref1 is still usable
}
This mechanism allows you to pass a mutable reference to multiple functions sequentially or convert &mut T to &T without consuming the original reference.