]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/index-mut-help.stderr
Auto merge of #98051 - davidtwco:split-dwarf-stabilization, r=wesleywiser
[rust.git] / src / test / ui / borrowck / index-mut-help.stderr
1 error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable
2   --> $DIR/index-mut-help.rs:11:5
3    |
4 LL |     map["peter"].clear();
5    |     ^^^^^^^^^^^^^^^^^^^^ cannot borrow as mutable
6    |
7    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
8    = help: to modify a `HashMap<&str, String>`, use `.get_mut()`, `.insert()` or the entry API
9
10 error[E0594]: cannot assign to data in an index of `HashMap<&str, String>`
11   --> $DIR/index-mut-help.rs:12:5
12    |
13 LL |     map["peter"] = "0".to_string();
14    |     ^^^^^^^^^^^^ cannot assign
15    |
16    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
17    = help: to modify a `HashMap<&str, String>`, use `.get_mut()`, `.insert()` or the entry API
18
19 error[E0596]: cannot borrow data in an index of `HashMap<&str, String>` as mutable
20   --> $DIR/index-mut-help.rs:13:13
21    |
22 LL |     let _ = &mut map["peter"];
23    |             ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
24    |
25    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `HashMap<&str, String>`
26    = help: to modify a `HashMap<&str, String>`, use `.get_mut()`, `.insert()` or the entry API
27
28 error: aborting due to 3 previous errors
29
30 Some errors have detailed explanations: E0594, E0596.
31 For more information about an error, try `rustc --explain E0594`.