]> git.proxmox.com Git - rustc.git/blob - src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
New upstream version 1.64.0+dfsg1
[rustc.git] / src / test / ui / nll / closure-requirements / propagate-approximated-shorter-to-static-comparing-against-free.stderr
1 note: no external requirements
2 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:21:15
3 |
4 LL | foo(cell, |cell_a, cell_x| {
5 | ^^^^^^^^^^^^^^^^
6 |
7 = note: defining type: case1::{closure#0} with closure substs [
8 i32,
9 for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }) u32>)),
10 (),
11 ]
12
13 error[E0521]: borrowed data escapes outside of closure
14 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:22:9
15 |
16 LL | foo(cell, |cell_a, cell_x| {
17 | ------ ------ `cell_x` is a reference that is only valid in the closure body
18 | |
19 | `cell_a` declared here, outside of the closure body
20 LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
21 | ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here
22
23 note: no external requirements
24 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1
25 |
26 LL | / fn case1() {
27 LL | | let a = 0;
28 LL | | let cell = Cell::new(&a);
29 LL | | foo(cell, |cell_a, cell_x| {
30 ... |
31 LL | | })
32 LL | | }
33 | |_^
34 |
35 = note: defining type: case1
36
37 note: external requirements
38 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15
39 |
40 LL | foo(cell, |cell_a, cell_x| {
41 | ^^^^^^^^^^^^^^^^
42 |
43 = note: defining type: case2::{closure#0} with closure substs [
44 i32,
45 for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrNamed('r) }) u32>)),
46 (),
47 ]
48 = note: number of external vids: 2
49 = note: where '_#1r: '_#0r
50
51 note: no external requirements
52 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1
53 |
54 LL | / fn case2() {
55 LL | | let a = 0;
56 LL | | let cell = Cell::new(&a);
57 LL | |
58 ... |
59 LL | | })
60 LL | | }
61 | |_^
62 |
63 = note: defining type: case2
64
65 error[E0597]: `a` does not live long enough
66 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
67 |
68 LL | let cell = Cell::new(&a);
69 | ^^ borrowed value does not live long enough
70 ...
71 LL | / foo(cell, |cell_a, cell_x| {
72 LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
73 LL | | })
74 | |______- argument requires that `a` is borrowed for `'static`
75 LL | }
76 | - `a` dropped here while still borrowed
77
78 error: aborting due to 2 previous errors
79
80 Some errors have detailed explanations: E0521, E0597.
81 For more information about an error, try `rustc --explain E0521`.