summary refs log tree commit diff
path: root/src/test/ui/borrowck/borrowck-borrow-from-stack-variable.stderr
blob: fe60d944a44fb333d23f4264c45af05545bafacb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
  --> $DIR/borrowck-borrow-from-stack-variable.rs:18:22
   |
LL |     let bar1 = &mut foo.bar1;
   |                     -------- first mutable borrow occurs here
LL |     let _bar2 = &mut foo.bar1;
   |                      ^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
LL | }
   | - first borrow ends here

error[E0502]: cannot borrow `foo.bar1` as immutable because it is also borrowed as mutable
  --> $DIR/borrowck-borrow-from-stack-variable.rs:25:18
   |
LL |     let bar1 = &mut foo.bar1;
   |                     -------- mutable borrow occurs here
LL |     let _bar2 = &foo.bar1;
   |                  ^^^^^^^^ immutable borrow occurs here
LL |     *bar1;
LL | }
   | - mutable borrow ends here

error[E0502]: cannot borrow `foo.bar1` as mutable because it is also borrowed as immutable
  --> $DIR/borrowck-borrow-from-stack-variable.rs:32:22
   |
LL |     let bar1 = &foo.bar1;
   |                 -------- immutable borrow occurs here
LL |     let _bar2 = &mut foo.bar1;
   |                      ^^^^^^^^ mutable borrow occurs here
LL |     *bar1;
LL | }
   | - immutable borrow ends here

error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
  --> $DIR/borrowck-borrow-from-stack-variable.rs:61:21
   |
LL |     let bar1 = &mut foo.bar1;
   |                     -------- first mutable borrow occurs here
LL |     match foo {
LL |         Foo { bar1: ref mut _bar1, bar2: _ } => {} //
   |                     ^^^^^^^^^^^^^ second mutable borrow occurs here
...
LL | }
   | - first borrow ends here

error[E0502]: cannot borrow `foo.bar1` as immutable because `foo.bar1.int1` is also borrowed as mutable
  --> $DIR/borrowck-borrow-from-stack-variable.rs:70:18
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                     ------------- mutable borrow occurs here
LL |     let _foo1 = &foo.bar1;
   |                  ^^^^^^^^ immutable borrow occurs here
...
LL | }
   | - mutable borrow ends here

error[E0502]: cannot borrow `foo` as immutable because `foo.bar1.int1` is also borrowed as mutable
  --> $DIR/borrowck-borrow-from-stack-variable.rs:71:18
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                     ------------- mutable borrow occurs here
LL |     let _foo1 = &foo.bar1;
LL |     let _foo2 = &foo;
   |                  ^^^ immutable borrow occurs here
LL |     *bar1;
LL | }
   | - mutable borrow ends here

error[E0499]: cannot borrow `foo.bar1` as mutable more than once at a time
  --> $DIR/borrowck-borrow-from-stack-variable.rs:78:22
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                     ------------- first mutable borrow occurs here
LL |     let _foo1 = &mut foo.bar1;
   |                      ^^^^^^^^ second mutable borrow occurs here
LL |     *bar1;
LL | }
   | - first borrow ends here

error[E0499]: cannot borrow `foo` as mutable more than once at a time
  --> $DIR/borrowck-borrow-from-stack-variable.rs:85:22
   |
LL |     let bar1 = &mut foo.bar1.int1;
   |                     ------------- first mutable borrow occurs here
LL |     let _foo2 = &mut foo;
   |                      ^^^ second mutable borrow occurs here
LL |     *bar1;
LL | }
   | - first borrow ends here

error[E0502]: cannot borrow `foo.bar1` as mutable because `foo.bar1.int1` is also borrowed as immutable
  --> $DIR/borrowck-borrow-from-stack-variable.rs:92:22
   |
LL |     let bar1 = &foo.bar1.int1;
   |                 ------------- immutable borrow occurs here
LL |     let _foo1 = &mut foo.bar1;
   |                      ^^^^^^^^ mutable borrow occurs here
LL |     *bar1;
LL | }
   | - immutable borrow ends here

error[E0502]: cannot borrow `foo` as mutable because `foo.bar1.int1` is also borrowed as immutable
  --> $DIR/borrowck-borrow-from-stack-variable.rs:99:22
   |
LL |     let bar1 = &foo.bar1.int1;
   |                 ------------- immutable borrow occurs here
LL |     let _foo2 = &mut foo;
   |                      ^^^ mutable borrow occurs here
LL |     *bar1;
LL | }
   | - immutable borrow ends here

error[E0596]: cannot borrow field `foo.bar1` of immutable binding as mutable
  --> $DIR/borrowck-borrow-from-stack-variable.rs:120:21
   |
LL |     let foo = make_foo();
   |         --- help: make this binding mutable: `mut foo`
LL |     let bar1 = &mut foo.bar1;
   |                     ^^^^^^^^ cannot mutably borrow field of immutable binding

error: aborting due to 11 previous errors

Some errors occurred: E0499, E0502, E0596.
For more information about an error, try `rustc --explain E0499`.