]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/borrowck-overloaded-index-ref-index.stderr
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / borrowck-overloaded-index-ref-index.stderr
1 error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
2   --> $DIR/borrowck-overloaded-index-ref-index.rs:49:22
3    |
4 LL |     let rs = &mut s;
5    |              ------ mutable borrow occurs here
6 LL |     println!("{}", f[&s]);
7    |                      ^^ immutable borrow occurs here
8 ...
9 LL |     drop(rs);
10    |          -- mutable borrow later used here
11
12 error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
13   --> $DIR/borrowck-overloaded-index-ref-index.rs:51:7
14    |
15 LL |     let rs = &mut s;
16    |              ------ mutable borrow occurs here
17 ...
18 LL |     f[&s] = 10;
19    |       ^^ immutable borrow occurs here
20 ...
21 LL |     drop(rs);
22    |          -- mutable borrow later used here
23
24 error[E0594]: cannot assign to data in an index of `Bar`
25   --> $DIR/borrowck-overloaded-index-ref-index.rs:56:5
26    |
27 LL |     s[2] = 20;
28    |     ^^^^^^^^^ cannot assign
29    |
30    = help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Bar`
31
32 error: aborting due to 3 previous errors
33
34 Some errors have detailed explanations: E0502, E0594.
35 For more information about an error, try `rustc --explain E0502`.