fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
1.0 KiB32 linesraw
1error[E0501]: cannot borrow `*f` as mutable because previous closure requires unique access
2  --> $DIR/borrowck-insert-during-each.rs:16:5
3   |
4LL |       f.foo(
5   |       ^ --- first borrow later used by call
6   |  _____|
7   | |
8LL | |
9LL | |         |a| {
10   | |         --- closure construction occurs here
11LL | |             f.n.insert(*a);
12   | |             - first borrow occurs due to use of `f` in closure
13LL | |         })
14   | |__________^ second borrow occurs here
15
16error[E0500]: closure requires unique access to `f` but it is already borrowed
17  --> $DIR/borrowck-insert-during-each.rs:18:9
18   |
19LL |     f.foo(
20   |     - --- first borrow later used by call
21   |     |
22   |     borrow occurs here
23LL |
24LL |         |a| {
25   |         ^^^ closure construction occurs here
26LL |             f.n.insert(*a);
27   |             - second borrow occurs due to use of `f` in closure
28
29error: aborting due to 2 previous errors
30
31Some errors have detailed explanations: E0500, E0501.
32For more information about an error, try `rustc --explain E0500`.