rust/tests/ui/nll/region-ends-after-if-condition.stderr

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

16 lines
615 B
Plaintext
Raw Normal View History

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);
| ----- 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`.