1 error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
2 --> $DIR/borrowck-borrow-from-owned-ptr.rs:29:22
4 LL | let bar1 = &mut foo.bar1;
5 | -------- first mutable borrow occurs here
6 LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
7 | ^^^^^^^^ second mutable borrow occurs here
10 | - first borrow ends here
12 error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
13 --> $DIR/borrowck-borrow-from-owned-ptr.rs:36:18
15 LL | let bar1 = &mut foo.bar1;
16 | -------- mutable borrow occurs here
17 LL | let _bar2 = &foo.bar1; //~ ERROR cannot borrow
18 | ^^^^^^^^ immutable borrow occurs here
21 | - mutable borrow ends here
23 error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
24 --> $DIR/borrowck-borrow-from-owned-ptr.rs:43:22
26 LL | let bar1 = &foo.bar1;
27 | -------- immutable borrow occurs here
28 LL | let _bar2 = &mut foo.bar1; //~ ERROR cannot borrow
29 | ^^^^^^^^ mutable borrow occurs here
32 | - immutable borrow ends here
34 error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time
35 --> $DIR/borrowck-borrow-from-owned-ptr.rs:57:22
37 LL | let bar1 = &mut foo.bar1;
38 | -------- first mutable borrow occurs here (via `foo.bar1`)
39 LL | let _bar2 = &mut foo.bar2; //~ ERROR cannot borrow
40 | ^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`)
43 | - first borrow ends here
45 error[E0499]: cannot borrow `foo` (via `foo.bar2`) as mutable more than once at a time
46 --> $DIR/borrowck-borrow-from-owned-ptr.rs:64:42
48 LL | Foo { bar1: ref mut _bar1, bar2: ref mut _bar2 } => {}
49 | ------------- ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2`)
51 | first mutable borrow occurs here (via `foo.bar1`)
52 LL | //~^ ERROR cannot borrow
54 | - first borrow ends here
56 error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
57 --> $DIR/borrowck-borrow-from-owned-ptr.rs:73:21
59 LL | let bar1 = &mut foo.bar1;
60 | -------- first mutable borrow occurs here
62 LL | Foo { bar1: ref mut _bar1, bar2: _ } => {}
63 | ^^^^^^^^^^^^^ second mutable borrow occurs here
66 | - first borrow ends here
68 error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
69 --> $DIR/borrowck-borrow-from-owned-ptr.rs:82:18
71 LL | let bar1 = &mut foo.bar1.int1;
72 | ------------- mutable borrow occurs here
73 LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
74 | ^^^^^^^^ immutable borrow occurs here
77 | - mutable borrow ends here
79 error[E0502]: cannot borrow `*foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
80 --> $DIR/borrowck-borrow-from-owned-ptr.rs:83:18
82 LL | let bar1 = &mut foo.bar1.int1;
83 | ------------- mutable borrow occurs here
84 LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
85 LL | let _foo2 = &*foo; //~ ERROR cannot borrow
86 | ^^^^ immutable borrow occurs here
89 | - mutable borrow ends here
91 error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
92 --> $DIR/borrowck-borrow-from-owned-ptr.rs:90:22
94 LL | let bar1 = &mut foo.bar1.int1;
95 | ------------- first mutable borrow occurs here
96 LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
97 | ^^^^^^^^ second mutable borrow occurs here
100 | - first borrow ends here
102 error[E0499]: cannot borrow `*foo` as mutable more than once at a time
103 --> $DIR/borrowck-borrow-from-owned-ptr.rs:97:22
105 LL | let bar1 = &mut foo.bar1.int1;
106 | ------------- first mutable borrow occurs here
107 LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow
108 | ^^^^ second mutable borrow occurs here
111 | - first borrow ends here
113 error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
114 --> $DIR/borrowck-borrow-from-owned-ptr.rs:104:22
116 LL | let bar1 = &foo.bar1.int1;
117 | ------------- immutable borrow occurs here
118 LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
119 | ^^^^^^^^ mutable borrow occurs here
122 | - immutable borrow ends here
124 error[E0502]: cannot borrow `*foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
125 --> $DIR/borrowck-borrow-from-owned-ptr.rs:111:22
127 LL | let bar1 = &foo.bar1.int1;
128 | ------------- immutable borrow occurs here
129 LL | let _foo2 = &mut *foo; //~ ERROR cannot borrow
130 | ^^^^ mutable borrow occurs here
133 | - immutable borrow ends here
135 error[E0502]: cannot borrow `foo` (via `foo.bar2`) as immutable because `foo` is also borrowed as mutable (via `foo.bar1`)
136 --> $DIR/borrowck-borrow-from-owned-ptr.rs:126:18
138 LL | let bar1 = &mut foo.bar1;
139 | -------- mutable borrow occurs here (via `foo.bar1`)
140 LL | let _foo1 = &foo.bar2; //~ ERROR cannot borrow
141 | ^^^^^^^^ immutable borrow occurs here (via `foo.bar2`)
144 | - mutable borrow ends here
146 error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
147 --> $DIR/borrowck-borrow-from-owned-ptr.rs:132:21
149 LL | let foo = make_foo();
150 | --- help: make this binding mutable: `mut foo`
151 LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
152 | ^^^^^^^^ cannot mutably borrow field of immutable binding
154 error[E0499]: cannot borrow `foo` (via `foo.bar2.int2`) as mutable more than once at a time
155 --> $DIR/borrowck-borrow-from-owned-ptr.rs:139:21
157 LL | let bar1 = &mut foo.bar1.int1;
158 | ------------- first mutable borrow occurs here (via `foo.bar1.int1`)
159 LL | let foo1 = &mut foo.bar2.int2; //~ ERROR cannot borrow
160 | ^^^^^^^^^^^^^ second mutable borrow occurs here (via `foo.bar2.int2`)
163 | - first borrow ends here
165 error: aborting due to 15 previous errors
167 Some errors occurred: E0499, E0502, E0596.
168 For more information about an error, try `rustc --explain E0499`.