Closed
Description
This code fails to compile:
fn main() {
let bar = ~(1,2);
foo(bar);
}
fn foo<T,U>(x: &(T,U)) {
let (ref a, ref b) = *x; // error: moving out of dereference of immutable & pointer
}
...but this (seemingly) logically equivalent does compile:
fn main() {
let bar = ~(1,2);
foo(bar);
}
fn foo<T,U>(x: &(T,U)) {
let (a, b) = match *x {
(ref a, ref b) => (a, b)
};
}
Metadata
Metadata
Assignees
Labels
No labels