2018-04-09 04:28:00 -05:00
|
|
|
warning: not reporting region error due to nll
|
2017-12-07 04:20:12 -06:00
|
|
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:5
|
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | foo(cell, |cell_a, cell_x| {
|
2017-12-07 04:20:12 -06:00
|
|
|
| ^^^
|
|
|
|
|
2018-07-21 09:50:06 -05:00
|
|
|
error: borrowed data escapes outside of closure
|
2018-07-25 08:36:03 -05:00
|
|
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:33:9
|
2017-12-07 04:20:12 -06:00
|
|
|
|
|
2018-07-03 10:38:09 -05:00
|
|
|
LL | foo(cell, |cell_a, cell_x| {
|
2018-07-21 09:50:06 -05:00
|
|
|
| ------ ------ `cell_x` is a reference that is only valid in the closure body
|
2018-07-03 10:38:09 -05:00
|
|
|
| |
|
2018-07-21 09:50:06 -05:00
|
|
|
| `cell_a` is declared here, outside of the closure body
|
2018-07-03 10:38:09 -05:00
|
|
|
LL | //~^ WARNING not reporting region error due to nll
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
|
2018-07-25 08:36:03 -05:00
|
|
|
| ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here
|
2017-12-07 04:20:12 -06:00
|
|
|
|
2017-12-03 05:16:52 -06:00
|
|
|
note: No external requirements
|
2017-12-07 04:20:12 -06:00
|
|
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:15
|
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | foo(cell, |cell_a, cell_x| {
|
2017-12-07 04:20:12 -06:00
|
|
|
| _______________^
|
2018-04-09 04:28:00 -05:00
|
|
|
LL | | //~^ WARNING not reporting region error due to nll
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | | cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
|
2018-07-03 10:38:09 -05:00
|
|
|
LL | | //~^ ERROR
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | | })
|
2017-12-07 04:20:12 -06:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: defining type: DefId(0/1:12 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
|
|
|
|
i32,
|
2018-06-10 08:29:43 -05:00
|
|
|
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>))
|
2017-12-07 04:20:12 -06:00
|
|
|
]
|
|
|
|
|
|
|
|
note: No external requirements
|
|
|
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1
|
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | / fn case1() {
|
|
|
|
LL | | let a = 0;
|
|
|
|
LL | | let cell = Cell::new(&a);
|
|
|
|
LL | | foo(cell, |cell_a, cell_x| {
|
2017-12-07 04:20:12 -06:00
|
|
|
... |
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | | })
|
|
|
|
LL | | }
|
2017-12-07 04:20:12 -06:00
|
|
|
| |_^
|
|
|
|
|
|
|
|
|
= note: defining type: DefId(0/0:5 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
|
|
|
|
|
|
|
|
note: External requirements
|
2017-12-07 05:25:59 -06:00
|
|
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:46:15
|
2017-12-07 04:20:12 -06:00
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | foo(cell, |cell_a, cell_x| {
|
2017-12-07 04:20:12 -06:00
|
|
|
| _______________^
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | | cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
|
|
|
|
LL | | })
|
2017-12-07 04:20:12 -06:00
|
|
|
| |_____^
|
|
|
|
|
|
|
|
|
= note: defining type: DefId(0/1:13 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
|
|
|
|
i32,
|
2018-06-10 08:29:43 -05:00
|
|
|
for<'r> extern "rust-call" fn((std::cell::Cell<&'_#1r u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BrNamed(crate0:DefIndex(0:0), 'r)) u32>))
|
2017-12-07 04:20:12 -06:00
|
|
|
]
|
|
|
|
= note: number of external vids: 2
|
|
|
|
= note: where '_#1r: '_#0r
|
|
|
|
|
|
|
|
note: No external requirements
|
|
|
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:39:1
|
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | / fn case2() {
|
|
|
|
LL | | let a = 0;
|
|
|
|
LL | | let cell = Cell::new(&a);
|
|
|
|
LL | | //~^ ERROR `a` does not live long enough
|
2017-12-07 04:20:12 -06:00
|
|
|
... |
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | | })
|
|
|
|
LL | | }
|
2017-12-07 04:20:12 -06:00
|
|
|
| |_^
|
|
|
|
|
|
|
|
|
= note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
|
|
|
|
|
2017-12-07 05:25:59 -06:00
|
|
|
error[E0597]: `a` does not live long enough
|
|
|
|
--> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:41:26
|
|
|
|
|
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | let cell = Cell::new(&a);
|
2017-12-14 11:57:34 -06:00
|
|
|
| ^^ borrowed value does not live long enough
|
2017-12-07 05:25:59 -06:00
|
|
|
...
|
2018-02-22 18:42:32 -06:00
|
|
|
LL | }
|
2018-07-22 10:02:31 -05:00
|
|
|
| - `a` dropped here while still borrowed
|
2018-03-05 13:12:19 -06:00
|
|
|
|
|
|
|
|
= note: borrowed value must be valid for the static lifetime...
|
2017-12-07 05:25:59 -06:00
|
|
|
|
|
|
|
error: aborting due to 2 previous errors
|
2017-12-07 04:20:12 -06:00
|
|
|
|
2018-03-03 08:59:40 -06:00
|
|
|
For more information about this error, try `rustc --explain E0597`.
|