]>
Commit | Line | Data |
---|---|---|
dfeec247 | 1 | note: no external requirements |
0731742a | 2 | --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:21:15 |
ff7c6d11 | 3 | | |
0531ce1d | 4 | LL | foo(cell, |cell_a, cell_x| { |
ff7c6d11 | 5 | | _______________^ |
0531ce1d | 6 | LL | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure |
532ac7d7 | 7 | LL | | |
0531ce1d | 8 | LL | | }) |
ff7c6d11 XL |
9 | | |_____^ |
10 | | | |
1b1a35ee | 11 | = note: defining type: case1::{closure#0} with closure substs [ |
ff7c6d11 | 12 | i32, |
60c5eb7d | 13 | for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)), |
ba9703b0 | 14 | (), |
ff7c6d11 XL |
15 | ] |
16 | ||
0bf4aa26 | 17 | error[E0521]: borrowed data escapes outside of closure |
0731742a | 18 | --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:22:9 |
b7449926 XL |
19 | | |
20 | LL | foo(cell, |cell_a, cell_x| { | |
21 | | ------ ------ `cell_x` is a reference that is only valid in the closure body | |
22 | | | | |
74b04a01 | 23 | | `cell_a` declared here, outside of the closure body |
b7449926 XL |
24 | LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure |
25 | | ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here | |
26 | ||
dfeec247 | 27 | note: no external requirements |
0731742a | 28 | --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1 |
ff7c6d11 | 29 | | |
0531ce1d XL |
30 | LL | / fn case1() { |
31 | LL | | let a = 0; | |
32 | LL | | let cell = Cell::new(&a); | |
33 | LL | | foo(cell, |cell_a, cell_x| { | |
ff7c6d11 | 34 | ... | |
0531ce1d XL |
35 | LL | | }) |
36 | LL | | } | |
ff7c6d11 XL |
37 | | |_^ |
38 | | | |
60c5eb7d | 39 | = note: defining type: case1 |
ff7c6d11 | 40 | |
dfeec247 | 41 | note: external requirements |
0731742a | 42 | --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15 |
ff7c6d11 | 43 | | |
0531ce1d | 44 | LL | foo(cell, |cell_a, cell_x| { |
ff7c6d11 | 45 | | _______________^ |
0531ce1d XL |
46 | LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error |
47 | LL | | }) | |
ff7c6d11 XL |
48 | | |_____^ |
49 | | | |
1b1a35ee | 50 | = note: defining type: case2::{closure#0} with closure substs [ |
ff7c6d11 | 51 | i32, |
60c5eb7d | 52 | for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)), |
ba9703b0 | 53 | (), |
ff7c6d11 XL |
54 | ] |
55 | = note: number of external vids: 2 | |
56 | = note: where '_#1r: '_#0r | |
57 | ||
dfeec247 | 58 | note: no external requirements |
0731742a | 59 | --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1 |
ff7c6d11 | 60 | | |
0531ce1d XL |
61 | LL | / fn case2() { |
62 | LL | | let a = 0; | |
63 | LL | | let cell = Cell::new(&a); | |
532ac7d7 | 64 | LL | | |
ff7c6d11 | 65 | ... | |
0531ce1d XL |
66 | LL | | }) |
67 | LL | | } | |
ff7c6d11 XL |
68 | | |_^ |
69 | | | |
60c5eb7d | 70 | = note: defining type: case2 |
ff7c6d11 XL |
71 | |
72 | error[E0597]: `a` does not live long enough | |
0731742a | 73 | --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26 |
ff7c6d11 | 74 | | |
0531ce1d | 75 | LL | let cell = Cell::new(&a); |
0bf4aa26 XL |
76 | | ----------^^- |
77 | | | | | |
78 | | | borrowed value does not live long enough | |
79 | | argument requires that `a` is borrowed for `'static` | |
ff7c6d11 | 80 | ... |
0531ce1d | 81 | LL | } |
8faf50e0 | 82 | | - `a` dropped here while still borrowed |
ff7c6d11 XL |
83 | |
84 | error: aborting due to 2 previous errors | |
85 | ||
48663c56 | 86 | For more information about this error, try `rustc --explain E0597`. |