rust/tests/ui/borrowck/borrowck-overloaded-index-ref-index.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

36 lines
1.2 KiB
Plaintext
Raw Normal View History

2018-08-08 12:28:26 +00:00
error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
--> $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);
| -- 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
--> $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);
| -- mutable borrow later used here
2018-08-08 12:28:26 +00:00
error[E0594]: cannot assign to data in an index of `Bar`
--> $DIR/borrowck-overloaded-index-ref-index.rs:56:5
2018-08-08 12:28:26 +00:00
|
LL | s[2] = 20;
| ^^^^^^^^^ cannot assign
|
= 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`.