You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pub type MoveList<M> = Option<Box<MoveNode<M>>>;
pub struct MoveNode<M> {
m: M,
n: MoveList<M>
}
pub fn pop_front<M>(ml: MoveList<M>) -> (Option<M>, MoveList<M>) {
match ml {
None => (None, None),
Some(box MoveNode { m, n }) => (Some(m), n)
}
}
produces the error message “error: use of collaterally moved value” pointing to the second match arm. See http://is.gd/kBotGl -- tested on 2015-01-16 again: same result.
But when the destructuring is split in two parts, it works:
pub fn pop_front<M>(ml: MoveList<M>) -> (Option<M>, MoveList<M>) {
match ml {
None => (None, None),
Some(box ml) => {
let MoveNode {m, n} = ml;
(Some(m), n)
}
}
}
This looks like a compiler bug to me.
The text was updated successfully, but these errors were encountered:
The code
produces the error message “error: use of collaterally moved value” pointing to the second match arm. See http://is.gd/kBotGl -- tested on 2015-01-16 again: same result.
But when the destructuring is split in two parts, it works:
This looks like a compiler bug to me.
The text was updated successfully, but these errors were encountered: