2 ms·
let x = Something(42); // a value that is not Copy. let y = Something(&x); // a reference, so we can't take ownership let Something(ref z) = y; // z is
by Veedrac 9y ago
let x = Something(42); // a value that is not Copy.
let y = Something(&x); // a reference, so we can't take ownership
let Something(ref z) = y; // z is a reference to x
z is a reference to &x, and is thus of type &&i32. You should normally just do
let Something(z) = y;