rust/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
Esteban Küber cc9631a371 When displaying multispans, ignore empty lines adjacent to ...
```
error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:98:18
    |
6   |       let _ = match true {
    |               ---------- `match` arms have incompatible types
7   |           true => (
    |  _________________-
8   | |             // last line shown in multispan header
...   |
96  | |
97  | |         ),
    | |_________- this is found to be of type `()`
98  |           false => "
    |  __________________^
...   |
119 | |
120 | |         ",
    | |_________^ expected `()`, found `&str`

error[E0308]: `match` arms have incompatible types
   --> tests/ui/codemap_tests/huge_multispan_highlight.rs:215:18
    |
122 |       let _ = match true {
    |               ---------- `match` arms have incompatible types
123 |           true => (
    |  _________________-
124 | |
125 | |         1 // last line shown in multispan header
...   |
213 | |
214 | |         ),
    | |_________- this is found to be of type `{integer}`
215 |           false => "
    |  __________________^
216 | |
217 | |
218 | |         1 last line shown in multispan
...   |
237 | |
238 | |         ",
    | |_________^ expected integer, found `&str`
```
2024-03-18 16:25:36 +00:00

77 lines
2.7 KiB
Plaintext

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 | | 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`.