]>
Commit | Line | Data |
---|---|---|
b7449926 XL |
1 | error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast) |
2 | --> $DIR/region-ends-after-if-condition.rs:29:9 | |
3 | | | |
4 | LL | let value = &my_struct.field; | |
5 | | --------------- immutable borrow occurs here | |
6 | LL | if value.is_empty() { | |
7 | LL | my_struct.field.push_str("Hello, world!"); | |
8 | | ^^^^^^^^^^^^^^^ mutable borrow occurs here | |
9 | ... | |
10 | LL | } | |
11 | | - immutable borrow ends here | |
12 | ||
13 | error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Ast) | |
14 | --> $DIR/region-ends-after-if-condition.rs:39:9 | |
15 | | | |
16 | LL | let value = &my_struct.field; | |
17 | | --------------- immutable borrow occurs here | |
18 | LL | if value.is_empty() { | |
19 | LL | my_struct.field.push_str("Hello, world!"); | |
20 | | ^^^^^^^^^^^^^^^ mutable borrow occurs here | |
21 | ... | |
22 | LL | } | |
23 | | - immutable borrow ends here | |
24 | ||
25 | error[E0502]: cannot borrow `my_struct.field` as mutable because it is also borrowed as immutable (Mir) | |
26 | --> $DIR/region-ends-after-if-condition.rs:39:9 | |
27 | | | |
28 | LL | let value = &my_struct.field; | |
29 | | ---------------- immutable borrow occurs here | |
30 | LL | if value.is_empty() { | |
31 | LL | my_struct.field.push_str("Hello, world!"); | |
32 | | ^^^^^^^^^^^^^^^ mutable borrow occurs here | |
33 | ... | |
34 | LL | drop(value); | |
0bf4aa26 | 35 | | ----- immutable borrow later used here |
b7449926 XL |
36 | |
37 | error: aborting due to 3 previous errors | |
38 | ||
39 | For more information about this error, try `rustc --explain E0502`. |