]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/index-mut-help.nll.stderr
Auto merge of #54624 - arielb1:evaluate-outlives, r=nikomatsakis
[rust.git] / src / test / ui / borrowck / index-mut-help.nll.stderr
1 error[E0596]: cannot borrow data in a `&` reference as mutable
2   --> $DIR/index-mut-help.rs:21:5
3    |
4 LL |     map["peter"].clear();           //~ ERROR
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
9 error[E0594]: cannot assign to data in a `&` reference
10   --> $DIR/index-mut-help.rs:22:5
11    |
12 LL |     map["peter"] = "0".to_string(); //~ ERROR
13    |     ^^^^^^^^^^^^ cannot assign
14
15 error[E0596]: cannot borrow data in a `&` reference as mutable
16   --> $DIR/index-mut-help.rs:23:13
17    |
18 LL |     let _ = &mut map["peter"];      //~ ERROR
19    |             ^^^^^^^^^^^^^^^^^ cannot borrow as mutable
20    |
21    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `std::collections::HashMap<&str, std::string::String>`
22
23 error: aborting due to 3 previous errors
24
25 Some errors occurred: E0594, E0596.
26 For more information about an error, try `rustc --explain E0594`.