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