Closed
Description
struct Foo {
items: Vec<i32>,
}
fn main() {
let Foo {items} = &Foo {items: vec![]};
items.push(12);
}
This produces the error:
error[E0596]: cannot borrow immutable borrowed content `*items` as mutable
--> src/main.rs:7:5
|
6 | let Foo {items} = &Foo {items: vec![]};
| ----- consider changing this to `items`
7 | items.push(12);
| ^^^^^ cannot borrow as mutable
The suggestion "consider changing this to items
" is pointless in that it won't solve the problem.