fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #72883 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum49cae55760d

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