summary refs log tree commit diff
path: root/src/test/ui/borrowck/borrowck-lend-flow-loop.stderr
blob: 534e30b564d7f572fff26f92f91caac52b54796c (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
error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
  --> $DIR/borrowck-lend-flow-loop.rs:35:17
   |
LL |     let mut x = &mut v;
   |                      - mutable borrow occurs here
...
LL |         borrow(&*v); //~ ERROR cannot borrow
   |                 ^^ immutable borrow occurs here
LL |     }
LL | }
   | - mutable borrow ends here

error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
  --> $DIR/borrowck-lend-flow-loop.rs:45:17
   |
LL |     let mut x = &mut v;
   |                      - mutable borrow occurs here
LL |     for _ in 0..3 {
LL |         borrow(&*v); //~ ERROR cannot borrow
   |                 ^^ immutable borrow occurs here
...
LL | }
   | - mutable borrow ends here

error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
  --> $DIR/borrowck-lend-flow-loop.rs:57:25
   |
LL |         borrow_mut(&mut *v); //~ ERROR cannot borrow
   |                         ^^ mutable borrow occurs here
LL |         _x = &v;
   |               - immutable borrow occurs here
LL |     }
LL | }
   | - immutable borrow ends here

error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
  --> $DIR/borrowck-lend-flow-loop.rs:69:25
   |
LL |         borrow_mut(&mut *v); //~ ERROR cannot borrow
   |                         ^^ mutable borrow occurs here
LL |         _x = &v;
   |               - immutable borrow occurs here
LL |     }
LL | }
   | - immutable borrow ends here

error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
  --> $DIR/borrowck-lend-flow-loop.rs:86:21
   |
LL |         _x = &v;
   |               - immutable borrow occurs here
...
LL |     borrow_mut(&mut *v); //~ ERROR cannot borrow
   |                     ^^ mutable borrow occurs here
LL | }
   | - immutable borrow ends here

error[E0502]: cannot borrow `*v` as mutable because `v` is also borrowed as immutable
  --> $DIR/borrowck-lend-flow-loop.rs:100:21
   |
LL |         _x = &v;
   |               - immutable borrow occurs here
...
LL |     borrow_mut(&mut *v); //~ ERROR cannot borrow
   |                     ^^ mutable borrow occurs here
LL | }
   | - immutable borrow ends here

error[E0502]: cannot borrow `*v` as immutable because `v` is also borrowed as mutable
  --> $DIR/borrowck-lend-flow-loop.rs:109:17
   |
LL |         borrow(&*v); //~ ERROR cannot borrow
   |                 ^^ immutable borrow occurs here
LL |         if cond2 {
LL |             x = &mut v; //~ ERROR cannot borrow
   |                      - mutable borrow occurs here
...
LL | }
   | - mutable borrow ends here

error[E0499]: cannot borrow `v` as mutable more than once at a time
  --> $DIR/borrowck-lend-flow-loop.rs:111:22
   |
LL |             x = &mut v; //~ ERROR cannot borrow
   |                      ^ mutable borrow starts here in previous iteration of loop
...
LL | }
   | - mutable borrow ends here

error: aborting due to 8 previous errors

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