summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
blob: 4e3bf1d70429d29c5144bf16e612ce71296b14c8 (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
error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
  --> $DIR/issue-109271-pass-self-into-closure.rs:19:5
   |
LL |     v.call(|(), this: &mut S| v.get());
   |     ^^----^------------------^-^^^^^^^
   |     | |    |                  |
   |     | |    |                  first borrow occurs due to use of `v` in closure
   |     | |    |                  help: try using the closure argument: `this`
   |     | |    immutable borrow occurs here
   |     | immutable borrow later used by call
   |     mutable borrow occurs here

error[E0499]: cannot borrow `v` as mutable more than once at a time
  --> $DIR/issue-109271-pass-self-into-closure.rs:21:5
   |
LL |     v.call(|(), this: &mut S| v.set());
   |     ^^----^------------------^-^^^^^^^
   |     | |    |                  |
   |     | |    |                  first borrow occurs due to use of `v` in closure
   |     | |    |                  help: try using the closure argument: `this`
   |     | |    first mutable borrow occurs here
   |     | first borrow later used by call
   |     second mutable borrow occurs here

error[E0499]: cannot borrow `v` as mutable more than once at a time
  --> $DIR/issue-109271-pass-self-into-closure.rs:21:12
   |
LL |     v.call(|(), this: &mut S| v.set());
   |     - ---- ^^^^^^^^^^^^^^^^^^ - second borrow occurs due to use of `v` in closure
   |     | |    |
   |     | |    second mutable borrow occurs here
   |     | first borrow later used by call
   |     first mutable borrow occurs here

error[E0499]: cannot borrow `v` as mutable more than once at a time
  --> $DIR/issue-109271-pass-self-into-closure.rs:25:5
   |
LL |       v.call(|(), this: &mut S| {
   |       ^ ---- ------------------ first mutable borrow occurs here
   |       | |
   |  _____| first borrow later used by call
   | |
LL | |
LL | |
LL | |
LL | |         _ = v;
LL | |         v.set();
   | |         - first borrow occurs due to use of `v` in closure
...  |
LL | |         _ = v.add(3);
LL | |     });
   | |______^ second mutable borrow occurs here
   |
help: try using the closure argument
   |
LL ~         _ = this;
LL ~         this.set();
LL ~         this.get();
LL ~         S::get(&this);
   |

error[E0499]: cannot borrow `v` as mutable more than once at a time
  --> $DIR/issue-109271-pass-self-into-closure.rs:25:12
   |
LL |     v.call(|(), this: &mut S| {
   |     - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
   |     | |
   |     | first borrow later used by call
   |     first mutable borrow occurs here
...
LL |         v.set();
   |         - second borrow occurs due to use of `v` in closure

error: aborting due to 5 previous errors

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