1 error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
2 --> $DIR/borrowck-borrow-from-stack-variable.rs:28: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-stack-variable.rs:35: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-stack-variable.rs:42: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.bar1` as mutable more than once at a time
35 --> $DIR/borrowck-borrow-from-stack-variable.rs:71:21
37 LL | let bar1 = &mut foo.bar1;
38 | -------- first mutable borrow occurs here
40 LL | Foo { bar1: ref mut _bar1, bar2: _ } => {} //
41 | ^^^^^^^^^^^^^ second mutable borrow occurs here
44 | - first borrow ends here
46 error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
47 --> $DIR/borrowck-borrow-from-stack-variable.rs:80:18
49 LL | let bar1 = &mut foo.bar1.int1;
50 | ------------- mutable borrow occurs here
51 LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
52 | ^^^^^^^^ immutable borrow occurs here
55 | - mutable borrow ends here
57 error[E0502]: cannot borrow `foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
58 --> $DIR/borrowck-borrow-from-stack-variable.rs:81:18
60 LL | let bar1 = &mut foo.bar1.int1;
61 | ------------- mutable borrow occurs here
62 LL | let _foo1 = &foo.bar1; //~ ERROR cannot borrow
63 LL | let _foo2 = &foo; //~ ERROR cannot borrow
64 | ^^^ immutable borrow occurs here
67 | - mutable borrow ends here
69 error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
70 --> $DIR/borrowck-borrow-from-stack-variable.rs:88:22
72 LL | let bar1 = &mut foo.bar1.int1;
73 | ------------- first mutable borrow occurs here
74 LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
75 | ^^^^^^^^ second mutable borrow occurs here
78 | - first borrow ends here
80 error[E0499]: cannot borrow `foo` as mutable more than once at a time
81 --> $DIR/borrowck-borrow-from-stack-variable.rs:95:22
83 LL | let bar1 = &mut foo.bar1.int1;
84 | ------------- first mutable borrow occurs here
85 LL | let _foo2 = &mut foo; //~ ERROR cannot borrow
86 | ^^^ second mutable borrow occurs here
89 | - first borrow ends here
91 error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
92 --> $DIR/borrowck-borrow-from-stack-variable.rs:102:22
94 LL | let bar1 = &foo.bar1.int1;
95 | ------------- immutable borrow occurs here
96 LL | let _foo1 = &mut foo.bar1; //~ ERROR cannot borrow
97 | ^^^^^^^^ mutable borrow occurs here
100 | - immutable borrow ends here
102 error[E0502]: cannot borrow `foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
103 --> $DIR/borrowck-borrow-from-stack-variable.rs:109:22
105 LL | let bar1 = &foo.bar1.int1;
106 | ------------- immutable borrow occurs here
107 LL | let _foo2 = &mut foo; //~ ERROR cannot borrow
108 | ^^^ mutable borrow occurs here
111 | - immutable borrow ends here
113 error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
114 --> $DIR/borrowck-borrow-from-stack-variable.rs:130:21
116 LL | let foo = make_foo();
117 | --- help: make this binding mutable: `mut foo`
118 LL | let bar1 = &mut foo.bar1; //~ ERROR cannot borrow
119 | ^^^^^^^^ cannot mutably borrow field of immutable binding
121 error: aborting due to 11 previous errors
123 Some errors occurred: E0499, E0502, E0596.
124 For more information about an error, try `rustc --explain E0499`.