]> git.proxmox.com Git - rustc.git/blame - tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
New upstream version 1.73.0+dfsg1
[rustc.git] / tests / ui / borrowck / issue-109271-pass-self-into-closure.stderr
CommitLineData
49aad941
FG
1error[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 |
4LL | 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
13error[E0499]: cannot borrow `v` as mutable more than once at a time
14 --> $DIR/issue-109271-pass-self-into-closure.rs:21:5
15 |
16LL | 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
25error[E0499]: cannot borrow `v` as mutable more than once at a time
26 --> $DIR/issue-109271-pass-self-into-closure.rs:21:12
27 |
28LL | 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
35error[E0499]: cannot borrow `v` as mutable more than once at a time
36 --> $DIR/issue-109271-pass-self-into-closure.rs:25:5
37 |
38LL | v.call(|(), this: &mut S| {
39 | ^ ---- ------------------ first mutable borrow occurs here
40 | | |
41 | _____| first borrow later used by call
42 | |
43LL | |
44LL | |
45LL | |
46LL | | _ = v;
47LL | | v.set();
48 | | - first borrow occurs due to use of `v` in closure
49... |
50LL | | _ = v.add(3);
51LL | | });
52 | |______^ second mutable borrow occurs here
53 |
54help: try using the closure argument
55 |
56LL ~ _ = this;
57LL ~ this.set();
58LL ~ this.get();
59LL ~ S::get(&this);
60 |
61
62error[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
65LL | 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...
71LL | v.set();
72 | - second borrow occurs due to use of `v` in closure
49aad941
FG
73
74error: aborting due to 5 previous errors
75
76Some errors have detailed explanations: E0499, E0502.
77For more information about an error, try `rustc --explain E0499`.