fn main() {
let mut x : i32 = 0;
{
let mut y : &mut i32 = &mut x;
let mut z : &mut &mut i32 = &mut y;
*z = z;
// *z: &mut i32, so z gets coerced from
// &mut &mut i32 to &mut i32
// same as doing *z = *z;
}
}
References to references coerce to references to reduce indirection.
This forum is meant for discissing the Rust compiler and the specification of the Rust language. Please direct general questions to users.rust-lang.org