Closed
Description
This fails with "cannot mutably borrow more than once" errors
fn push(mut node: Box<(i32, i32)>) {
let (ref mut left, ref mut right) = *node;
}
Same here:
fn push(mut node: Box<(i32, i32)>) {
let box (ref mut left, ref mut right) = node;
}
This works:
fn push(mut node: Box<(i32, i32)>) {
let (ref mut left, ref mut right) = *&mut *node;
}
This also works:
fn push(node: &mut (i32, i32)) {
let (ref mut left, ref mut right) = *node;
}
Same behavior with structs instead of tuples. Boxes are weird, destructuring into mutable borrows is weird, so I have no idea what is going on there.