fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.1 KiB34 linesraw
1error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
2  --> $DIR/borrowck-overloaded-index-ref-index.rs:49:22
3   |
4LL |     let rs = &mut s;
5   |              ------ mutable borrow occurs here
6LL |     println!("{}", f[&s]);
7   |                      ^^ immutable borrow occurs here
8...
9LL |     drop(rs);
10   |          -- mutable borrow later used here
11
12error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
13  --> $DIR/borrowck-overloaded-index-ref-index.rs:51:7
14   |
15LL |     let rs = &mut s;
16   |              ------ mutable borrow occurs here
17...
18LL |     f[&s] = 10;
19   |       ^^ immutable borrow occurs here
20...
21LL |     drop(rs);
22   |          -- mutable borrow later used here
23
24error[E0594]: cannot assign to data in an index of `Bar`
25  --> $DIR/borrowck-overloaded-index-ref-index.rs:56:5
26   |
27LL |     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
32error: aborting due to 3 previous errors
33
34For more information about this error, try `rustc --explain E0502`.