]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/borrowck-closures-unique.stderr
Do not use a suggestion to change a binding's name to a type
[rust.git] / src / test / ui / borrowck / borrowck-closures-unique.stderr
1 error[E0500]: closure requires unique access to `x` but it is already borrowed
2   --> $DIR/borrowck-closures-unique.rs:26:14
3    |
4 LL |     let c1 = || get(x);
5    |              --     - first borrow occurs due to use of `x` in closure
6    |              |
7    |              borrow occurs here
8 LL |     let c2 = || set(x);
9    |              ^^     - second borrow occurs due to use of `x` in closure
10    |              |
11    |              closure construction occurs here
12 LL |     c1;
13    |     -- first borrow later used here
14
15 error[E0500]: closure requires unique access to `x` but it is already borrowed
16   --> $DIR/borrowck-closures-unique.rs:32:14
17    |
18 LL |     let c1 = || get(x);
19    |              --     - first borrow occurs due to use of `x` in closure
20    |              |
21    |              borrow occurs here
22 LL |     let c2 = || { get(x); set(x); };
23    |              ^^               - second borrow occurs due to use of `x` in closure
24    |              |
25    |              closure construction occurs here
26 LL |     c1;
27    |     -- first borrow later used here
28
29 error[E0524]: two closures require unique access to `x` at the same time
30   --> $DIR/borrowck-closures-unique.rs:38:14
31    |
32 LL |     let c1 = || set(x);
33    |              --     - first borrow occurs due to use of `x` in closure
34    |              |
35    |              first closure is constructed here
36 LL |     let c2 = || set(x);
37    |              ^^     - second borrow occurs due to use of `x` in closure
38    |              |
39    |              second closure is constructed here
40 LL |     c1;
41    |     -- first borrow later used here
42
43 error[E0594]: cannot assign to `x`, as it is not declared as mutable
44   --> $DIR/borrowck-closures-unique.rs:43:38
45    |
46 LL | fn e(x: &'static mut isize) {
47    |      - help: consider changing this to be mutable: `mut x`
48 LL |     let c1 = |y: &'static mut isize| x = y;
49    |                                      ^^^^^ cannot assign
50
51 error: aborting due to 4 previous errors
52
53 Some errors have detailed explanations: E0500, E0524, E0594.
54 For more information about an error, try `rustc --explain E0500`.