2018-08-08 07:28:26 -05:00
|
|
|
error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-overloaded-index-ref-index.rs:49:22
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let rs = &mut s;
|
|
|
|
| ------ mutable borrow occurs here
|
|
|
|
LL | println!("{}", f[&s]);
|
|
|
|
| ^^ immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(rs);
|
2018-09-29 05:47:47 -05:00
|
|
|
| -- mutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-overloaded-index-ref-index.rs:51:7
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let rs = &mut s;
|
|
|
|
| ------ mutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | f[&s] = 10;
|
|
|
|
| ^^ immutable borrow occurs here
|
|
|
|
...
|
|
|
|
LL | drop(rs);
|
2018-09-29 05:47:47 -05:00
|
|
|
| -- mutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-07-07 08:16:58 -05:00
|
|
|
error[E0594]: cannot assign to data in an index of `Bar`
|
2019-04-22 02:40:08 -05:00
|
|
|
--> $DIR/borrowck-overloaded-index-ref-index.rs:56:5
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | s[2] = 20;
|
|
|
|
| ^^^^^^^^^ cannot assign
|
2019-07-07 08:16:58 -05:00
|
|
|
|
|
|
|
|
= help: trait `IndexMut` is required to modify indexed content, but it is not implemented for `Bar`
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error: aborting due to 3 previous errors
|
|
|
|
|
2019-11-06 06:58:44 -06:00
|
|
|
Some errors have detailed explanations: E0502, E0594.
|
|
|
|
For more information about an error, try `rustc --explain E0502`.
|