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