]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/closure-requirements/propagate-approximated-shorter-to-static-comparing-against-free.stderr
Rollup merge of #52695 - oli-obk:const_err_panic, r=petrochenkov
[rust.git] / src / test / ui / nll / closure-requirements / propagate-approximated-shorter-to-static-comparing-against-free.stderr
1 warning: not reporting region error due to nll
2   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:5
3    |
4 LL |     foo(cell, |cell_a, cell_x| {
5    |     ^^^
6
7 error: borrowed data escapes outside of closure
8   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:33:20
9    |
10 LL |     foo(cell, |cell_a, cell_x| {
11    |                ------  ------ `cell_x` is a reference that is only valid in the closure body
12    |                |
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
17
18 note: No external requirements
19   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:31:15
20    |
21 LL |       foo(cell, |cell_a, cell_x| {
22    |  _______________^
23 LL | |         //~^ WARNING not reporting region error due to nll
24 LL | |         cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
25 LL | |         //~^ ERROR
26 LL | |     })
27    | |_____^
28    |
29    = note: defining type: DefId(0/1:12 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]::{{closure}}[0]) with closure substs [
30                i32,
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>))
32            ]
33
34 note: No external requirements
35   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1
36    |
37 LL | / fn case1() {
38 LL | |     let a = 0;
39 LL | |     let cell = Cell::new(&a);
40 LL | |     foo(cell, |cell_a, cell_x| {
41 ...  |
42 LL | |     })
43 LL | | }
44    | |_^
45    |
46    = note: defining type: DefId(0/0:5 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case1[0]) with substs []
47
48 note: External requirements
49   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:46:15
50    |
51 LL |       foo(cell, |cell_a, cell_x| {
52    |  _______________^
53 LL | |         cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
54 LL | |     })
55    | |_____^
56    |
57    = note: defining type: DefId(0/1:13 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]::{{closure}}[0]) with closure substs [
58                i32,
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>))
60            ]
61    = note: number of external vids: 2
62    = note: where '_#1r: '_#0r
63
64 note: No external requirements
65   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:39:1
66    |
67 LL | / fn case2() {
68 LL | |     let a = 0;
69 LL | |     let cell = Cell::new(&a);
70 LL | |     //~^ ERROR `a` does not live long enough
71 ...  |
72 LL | |     })
73 LL | | }
74    | |_^
75    |
76    = note: defining type: DefId(0/0:6 ~ propagate_approximated_shorter_to_static_comparing_against_free[317d]::case2[0]) with substs []
77
78 error[E0597]: `a` does not live long enough
79   --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:41:26
80    |
81 LL |     let cell = Cell::new(&a);
82    |                          ^^ borrowed value does not live long enough
83 ...
84 LL | }
85    | - `a` dropped here while still borrowed
86    |
87    = note: borrowed value must be valid for the static lifetime...
88
89 error: aborting due to 2 previous errors
90
91 For more information about this error, try `rustc --explain E0597`.