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