rust/src/test/ui/borrowck/borrowck-overloaded-index-ref-index.mir.stderr

33 lines
1.0 KiB
Plaintext
Raw Normal View History

2018-08-08 07:28:26 -05:00
error[E0502]: cannot borrow `s` as immutable because it is also borrowed as mutable
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-overloaded-index-ref-index.rs:52: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);
| -- 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
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-overloaded-index-ref-index.rs:55: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);
| -- mutable borrow later used here
2018-08-08 07:28:26 -05:00
error[E0594]: cannot assign to data in a `&` reference
2018-12-25 09:56:47 -06:00
--> $DIR/borrowck-overloaded-index-ref-index.rs:61:5
2018-08-08 07:28:26 -05:00
|
LL | s[2] = 20;
| ^^^^^^^^^ cannot assign
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0502`.