fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
1.3 KiB28 linesraw
1error[E0596]: cannot borrow data in an index of `std::collections::HashMap<&str, std::string::String>` as mutable
2  --> $DIR/index-mut-help.rs:11:5
3   |
4LL |     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 `std::collections::HashMap<&str, std::string::String>`
8
9error[E0594]: cannot assign to data in an index of `std::collections::HashMap<&str, std::string::String>`
10  --> $DIR/index-mut-help.rs:12:5
11   |
12LL |     map["peter"] = "0".to_string();
13   |     ^^^^^^^^^^^^ cannot assign
14   |
15   = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
16
17error[E0596]: cannot borrow data in an index of `std::collections::HashMap<&str, std::string::String>` as mutable
18  --> $DIR/index-mut-help.rs:13:13
19   |
20LL |     let _ = &mut map["peter"];
21   |             ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
22   |
23   = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
24
25error: aborting due to 3 previous errors
26
27Some errors have detailed explanations: E0594, E0596.
28For more information about an error, try `rustc --explain E0594`.