]> git.proxmox.com Git - rustc.git/blame - src/test/ui/nll/region-ends-after-if-condition.stderr
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / ui / nll / region-ends-after-if-condition.stderr
CommitLineData
b7449926
XL
1error[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 |
4LL | let value = &my_struct.field;
5 | --------------- immutable borrow occurs here
6LL | if value.is_empty() {
7LL | my_struct.field.push_str("Hello, world!");
8 | ^^^^^^^^^^^^^^^ mutable borrow occurs here
9...
10LL | }
11 | - immutable borrow ends here
12
13error[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 |
16LL | let value = &my_struct.field;
17 | --------------- immutable borrow occurs here
18LL | if value.is_empty() {
19LL | my_struct.field.push_str("Hello, world!");
20 | ^^^^^^^^^^^^^^^ mutable borrow occurs here
21...
22LL | }
23 | - immutable borrow ends here
24
25error[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 |
28LL | let value = &my_struct.field;
29 | ---------------- immutable borrow occurs here
30LL | if value.is_empty() {
31LL | my_struct.field.push_str("Hello, world!");
32 | ^^^^^^^^^^^^^^^ mutable borrow occurs here
33...
34LL | drop(value);
0bf4aa26 35 | ----- immutable borrow later used here
b7449926
XL
36
37error: aborting due to 3 previous errors
38
39For more information about this error, try `rustc --explain E0502`.