blob: 2b05503b58dbe17cd839df6d5f8818233dbb10d9 [file] [log] [blame]
note: No external requirements
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:21:15
|
LL | foo(cell, |cell_a, cell_x| {
| _______________^
LL | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
LL | |
LL | | })
| |_____^
|
= note: defining type: DefId(0:9 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
i32,
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)),
]
error[E0521]: borrowed data escapes outside of closure
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:22:9
|
LL | foo(cell, |cell_a, cell_x| {
| ------ ------ `cell_x` is a reference that is only valid in the closure body
| |
| `cell_a` is declared here, outside of the closure body
LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
| ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here
note: No external requirements
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1
|
LL | / fn case1() {
LL | | let a = 0;
LL | | let cell = Cell::new(&a);
LL | | foo(cell, |cell_a, cell_x| {
... |
LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:8 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
note: External requirements
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15
|
LL | foo(cell, |cell_a, cell_x| {
| _______________^
LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
LL | | })
| |_____^
|
= note: defining type: DefId(0:11 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
i32,
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed('r)) u32>)),
]
= note: number of external vids: 2
= note: where '_#1r: '_#0r
note: No external requirements
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1
|
LL | / fn case2() {
LL | | let a = 0;
LL | | let cell = Cell::new(&a);
LL | |
... |
LL | | })
LL | | }
| |_^
|
= note: defining type: DefId(0:10 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
error[E0597]: `a` does not live long enough
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
|
LL | let cell = Cell::new(&a);
| ----------^^-
| | |
| | borrowed value does not live long enough
| argument requires that `a` is borrowed for `'static`
...
LL | }
| - `a` dropped here while still borrowed
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0597`.