2019-05-02 17:34:15 -05:00
|
|
|
error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable
|
|
|
|
--> $DIR/region-ends-after-if-condition.rs:26:9
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let value = &my_struct.field;
|
|
|
|
| ---------------- immutable borrow occurs here
|
|
|
|
LL | if value.is_empty() {
|
|
|
|
LL | my_struct.field.push_str("Hello, world!");
|
2019-05-02 17:34:15 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ mutable borrow occurs here
|
2018-08-08 07:28:26 -05:00
|
|
|
...
|
|
|
|
LL | drop(value);
|
2018-09-29 05:47:47 -05:00
|
|
|
| ----- immutable borrow later used here
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-05-02 17:34:15 -05:00
|
|
|
error: aborting due to previous error
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
For more information about this error, try `rustc --explain E0502`.
|