]> git.lizzy.rs Git - rust.git/blob - src/test/ui/E0501.ast.nll.stderr
Rollup merge of #57132 - daxpedda:master, r=steveklabnik
[rust.git] / src / test / ui / E0501.ast.nll.stderr
1 error[E0501]: cannot borrow `*a` as mutable because previous closure requires unique access
2   --> $DIR/E0501.rs:18:23
3    |
4 LL |     let bar = || {
5    |               -- closure construction occurs here
6 LL |         inside_closure(a)
7    |                        - first borrow occurs due to use of `a` in closure
8 LL |     };
9 LL |     outside_closure_1(a); //[ast]~ ERROR cannot borrow `*a` as mutable because previous closure requires unique access
10    |                       ^ second borrow occurs here
11 ...
12 LL |     drop(bar);
13    |          --- first borrow later used here
14
15 error[E0501]: cannot borrow `*a` as immutable because previous closure requires unique access
16   --> $DIR/E0501.rs:21:23
17    |
18 LL |     let bar = || {
19    |               -- closure construction occurs here
20 LL |         inside_closure(a)
21    |                        - first borrow occurs due to use of `a` in closure
22 ...
23 LL |     outside_closure_2(a); //[ast]~ ERROR cannot borrow `*a` as immutable because previous closure requires unique access
24    |                       ^ second borrow occurs here
25 ...
26 LL |     drop(bar);
27    |          --- first borrow later used here
28
29 error: aborting due to 2 previous errors
30
31 For more information about this error, try `rustc --explain E0501`.