-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.fixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.
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.
Metadata
Metadata
Assignees
Labels
A-borrow-checkerArea: The borrow checkerArea: The borrow checkerC-bugCategory: This is a bug.Category: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.fixed-by-NLLBugs fixed, but only when NLL is enabled.Bugs fixed, but only when NLL is enabled.