]> git.proxmox.com Git - rustc.git/blob - src/test/ui/borrowck/borrowck-union-borrow.ast.nll.stderr
New upstream version 1.31.0~beta.4+dfsg1
[rustc.git] / src / test / ui / borrowck / borrowck-union-borrow.ast.nll.stderr
1 error[E0502]: cannot borrow `u.a` as mutable because it is also borrowed as immutable
2 --> $DIR/borrowck-union-borrow.rs:37:23
3 |
4 LL | let ra = &u.a;
5 | ---- immutable borrow occurs here
6 LL | let rma = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
7 | ^^^^^^^^ mutable borrow occurs here
8 LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable because it is also borrowed as immutable
9 LL | drop(ra);
10 | -- immutable borrow later used here
11
12 error[E0506]: cannot assign to `u.a` because it is borrowed
13 --> $DIR/borrowck-union-borrow.rs:43:13
14 |
15 LL | let ra = &u.a;
16 | ---- borrow of `u.a` occurs here
17 LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
18 | ^^^^^^^ assignment to borrowed `u.a` occurs here
19 LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
20 LL | drop(ra);
21 | -- borrow later used here
22
23 error[E0502]: cannot borrow `u.b` as mutable because it is also borrowed as immutable
24 --> $DIR/borrowck-union-borrow.rs:60:23
25 |
26 LL | let ra = &u.a;
27 | ---- immutable borrow occurs here
28 LL | let rmb = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable because `u` is also borrowed as immutable (via `u.a`)
29 | ^^^^^^^^ mutable borrow occurs here
30 LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable because it is also borrowed as immutable
31 LL | drop(ra);
32 | -- immutable borrow later used here
33
34 error[E0506]: cannot assign to `u.b` because it is borrowed
35 --> $DIR/borrowck-union-borrow.rs:66:13
36 |
37 LL | let ra = &u.a;
38 | ---- borrow of `u.b` occurs here
39 LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
40 | ^^^^^^^ assignment to borrowed `u.b` occurs here
41 LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
42 LL | drop(ra);
43 | -- borrow later used here
44
45 error[E0502]: cannot borrow `u.a` as immutable because it is also borrowed as mutable
46 --> $DIR/borrowck-union-borrow.rs:73:22
47 |
48 LL | let rma = &mut u.a;
49 | -------- mutable borrow occurs here
50 LL | let ra = &u.a; //[ast]~ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
51 | ^^^^ immutable borrow occurs here
52 LL | //[mir]~^ ERROR cannot borrow `u.a` as immutable because it is also borrowed as mutable
53 LL | drop(rma);
54 | --- mutable borrow later used here
55
56 error[E0503]: cannot use `u.a` because it was mutably borrowed
57 --> $DIR/borrowck-union-borrow.rs:79:21
58 |
59 LL | let ra = &mut u.a;
60 | -------- borrow of `u.a` occurs here
61 LL | let a = u.a; //[ast]~ ERROR cannot use `u.a` because it was mutably borrowed
62 | ^^^ use of borrowed `u.a`
63 LL | //[mir]~^ ERROR cannot use `u.a` because it was mutably borrowed
64 LL | drop(ra);
65 | -- borrow later used here
66
67 error[E0499]: cannot borrow `u.a` as mutable more than once at a time
68 --> $DIR/borrowck-union-borrow.rs:85:24
69 |
70 LL | let rma = &mut u.a;
71 | -------- first mutable borrow occurs here
72 LL | let rma2 = &mut u.a; //[ast]~ ERROR cannot borrow `u.a` as mutable more than once at a time
73 | ^^^^^^^^ second mutable borrow occurs here
74 LL | //[mir]~^ ERROR cannot borrow `u.a` as mutable more than once at a time
75 LL | drop(rma);
76 | --- first borrow later used here
77
78 error[E0506]: cannot assign to `u.a` because it is borrowed
79 --> $DIR/borrowck-union-borrow.rs:91:13
80 |
81 LL | let rma = &mut u.a;
82 | -------- borrow of `u.a` occurs here
83 LL | u.a = 1; //[ast]~ ERROR cannot assign to `u.a` because it is borrowed
84 | ^^^^^^^ assignment to borrowed `u.a` occurs here
85 LL | //[mir]~^ ERROR cannot assign to `u.a` because it is borrowed
86 LL | drop(rma);
87 | --- borrow later used here
88
89 error[E0502]: cannot borrow `u.b` as immutable because it is also borrowed as mutable
90 --> $DIR/borrowck-union-borrow.rs:98:22
91 |
92 LL | let rma = &mut u.a;
93 | -------- mutable borrow occurs here
94 LL | let rb = &u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as immutable because `u` is also borrowed as mutable (via `u.a`)
95 | ^^^^ immutable borrow occurs here
96 LL | //[mir]~^ ERROR cannot borrow `u.b` as immutable because it is also borrowed as mutable
97 LL | drop(rma);
98 | --- mutable borrow later used here
99
100 error[E0503]: cannot use `u.b` because it was mutably borrowed
101 --> $DIR/borrowck-union-borrow.rs:104:21
102 |
103 LL | let ra = &mut u.a;
104 | -------- borrow of `u.a` occurs here
105 LL | let b = u.b; //[ast]~ ERROR cannot use `u.b` because it was mutably borrowed
106 | ^^^ use of borrowed `u.a`
107 ...
108 LL | drop(ra);
109 | -- borrow later used here
110
111 error[E0499]: cannot borrow `u.b` as mutable more than once at a time
112 --> $DIR/borrowck-union-borrow.rs:111:24
113 |
114 LL | let rma = &mut u.a;
115 | -------- first mutable borrow occurs here
116 LL | let rmb2 = &mut u.b; //[ast]~ ERROR cannot borrow `u` (via `u.b`) as mutable more than once at a time
117 | ^^^^^^^^ second mutable borrow occurs here
118 LL | //[mir]~^ ERROR cannot borrow `u.b` as mutable more than once at a time
119 LL | drop(rma);
120 | --- first borrow later used here
121
122 error[E0506]: cannot assign to `u.b` because it is borrowed
123 --> $DIR/borrowck-union-borrow.rs:117:13
124 |
125 LL | let rma = &mut u.a;
126 | -------- borrow of `u.b` occurs here
127 LL | u.b = 1; //[ast]~ ERROR cannot assign to `u.b` because it is borrowed
128 | ^^^^^^^ assignment to borrowed `u.b` occurs here
129 LL | //[mir]~^ ERROR cannot assign to `u.b` because it is borrowed
130 LL | drop(rma);
131 | --- borrow later used here
132
133 error: aborting due to 12 previous errors
134
135 Some errors occurred: E0499, E0502, E0503, E0506.
136 For more information about an error, try `rustc --explain E0499`.