1 warning: not reporting region error due to nll
2 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:5
4 LL | foo(cell, |cell_a, cell_x| {
7 error: borrowed data escapes outside of closure
8 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:33:20
10 LL | foo(cell, |cell_a, cell_x| {
11 | ------ ------ `cell_x` is a reference that is only valid in the closure body
13 | `cell_a` is declared here, outside of the closure body
14 LL | //~^ WARNING not reporting region error due to nll
15 LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
16 | ^^^^^^^^^^^^ `cell_x` escapes the closure body here
18 note: No external requirements
19 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:15
21 LL | foo(cell, |cell_a, cell_x| {
23 LL | | //~^ WARNING not reporting region error due to nll
24 LL | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
29 = note: defining type: DefId(0/1:12 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
31 for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>))
34 note: No external requirements
35 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1
39 LL | | let cell = Cell::new(&a);
40 LL | | foo(cell, |cell_a, cell_x| {
46 = note: defining type: DefId(0/0:5 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
48 note: External requirements
49 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:46:15
51 LL | foo(cell, |cell_a, cell_x| {
53 LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
57 = note: defining type: DefId(0/1:13 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
59 for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>))
61 = note: number of external vids: 2
62 = note: where '_#1r: '_#0r
64 note: No external requirements
65 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:39:1
69 LL | | let cell = Cell::new(&a);
70 LL | | //~^ ERROR `a` does not live long enough
76 = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
78 error[E0597]: `a` does not live long enough
79 --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:41:26
81 LL | let cell = Cell::new(&a);
82 | ^^ borrowed value does not live long enough
85 | - borrowed value only lives until here
87 = note: borrowed value must be valid for the static lifetime...
89 error: aborting due to 2 previous errors
91 For more information about this error, try `rustc --explain E0597`.