]>
Commit | Line | Data |
---|---|---|
49aad941 FG |
1 | error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable |
2 | --> $DIR/issue-109271-pass-self-into-closure.rs:19:5 | |
3 | | | |
4 | LL | v.call(|(), this: &mut S| v.get()); | |
5 | | ^^----^------------------^-^^^^^^^ | |
6 | | | | | | | |
7 | | | | | first borrow occurs due to use of `v` in closure | |
8 | | | | | help: try using the closure argument: `this` | |
9 | | | | immutable borrow occurs here | |
10 | | | immutable borrow later used by call | |
11 | | mutable borrow occurs here | |
12 | ||
13 | error[E0499]: cannot borrow `v` as mutable more than once at a time | |
14 | --> $DIR/issue-109271-pass-self-into-closure.rs:21:5 | |
15 | | | |
16 | LL | v.call(|(), this: &mut S| v.set()); | |
17 | | ^^----^------------------^-^^^^^^^ | |
18 | | | | | | | |
19 | | | | | first borrow occurs due to use of `v` in closure | |
20 | | | | | help: try using the closure argument: `this` | |
21 | | | | first mutable borrow occurs here | |
22 | | | first borrow later used by call | |
23 | | second mutable borrow occurs here | |
24 | ||
25 | error[E0499]: cannot borrow `v` as mutable more than once at a time | |
26 | --> $DIR/issue-109271-pass-self-into-closure.rs:21:12 | |
27 | | | |
28 | LL | v.call(|(), this: &mut S| v.set()); | |
add651ee FG |
29 | | - ---- ^^^^^^^^^^^^^^^^^^ - second borrow occurs due to use of `v` in closure |
30 | | | | | | |
49aad941 FG |
31 | | | | second mutable borrow occurs here |
32 | | | first borrow later used by call | |
33 | | first mutable borrow occurs here | |
34 | ||
35 | error[E0499]: cannot borrow `v` as mutable more than once at a time | |
36 | --> $DIR/issue-109271-pass-self-into-closure.rs:25:5 | |
37 | | | |
38 | LL | v.call(|(), this: &mut S| { | |
39 | | ^ ---- ------------------ first mutable borrow occurs here | |
40 | | | | | |
41 | | _____| first borrow later used by call | |
42 | | | | |
43 | LL | | | |
44 | LL | | | |
45 | LL | | | |
46 | LL | | _ = v; | |
47 | LL | | v.set(); | |
48 | | | - first borrow occurs due to use of `v` in closure | |
49 | ... | | |
50 | LL | | _ = v.add(3); | |
51 | LL | | }); | |
52 | | |______^ second mutable borrow occurs here | |
53 | | | |
54 | help: try using the closure argument | |
55 | | | |
56 | LL ~ _ = this; | |
57 | LL ~ this.set(); | |
58 | LL ~ this.get(); | |
59 | LL ~ S::get(&this); | |
60 | | | |
61 | ||
62 | error[E0499]: cannot borrow `v` as mutable more than once at a time | |
63 | --> $DIR/issue-109271-pass-self-into-closure.rs:25:12 | |
64 | | | |
add651ee FG |
65 | LL | v.call(|(), this: &mut S| { |
66 | | - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here | |
67 | | | | | |
68 | | | first borrow later used by call | |
69 | | first mutable borrow occurs here | |
70 | ... | |
71 | LL | v.set(); | |
72 | | - second borrow occurs due to use of `v` in closure | |
49aad941 FG |
73 | |
74 | error: aborting due to 5 previous errors | |
75 | ||
76 | Some errors have detailed explanations: E0499, E0502. | |
77 | For more information about an error, try `rustc --explain E0499`. |