fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
2.6 KiB71 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   |               ^^^^^^^^^^^^^^^^
6   |
7   = note: defining type: case1::{closure#0} with closure args [
8               i32,
9               for<Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>)),
10               (),
11           ]
12
13error[E0521]: borrowed data escapes outside of closure
14  --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:22:9
15   |
16LL |     foo(cell, |cell_a, cell_x| {
17   |                ------  ------ `cell_x` is a reference that is only valid in the closure body
18   |                |
19   |                `cell_a` declared here, outside of the closure body
20LL |         cell_a.set(cell_x.get()); // forces 'x: 'a, error in closure
21   |         ^^^^^^^^^^^^^^^^^^^^^^^^ `cell_x` escapes the closure body here
22
23note: no external requirements
24  --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:18:1
25   |
26LL | fn case1() {
27   | ^^^^^^^^^^
28   |
29   = note: defining type: case1
30
31note: external requirements
32  --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:35:15
33   |
34LL |     foo(cell, |cell_a, cell_x| {
35   |               ^^^^^^^^^^^^^^^^
36   |
37   = note: defining type: case2::{closure#0} with closure args [
38               i32,
39               for<Region(BrAnon)> extern "rust-call" fn((std::cell::Cell<&'?1 u32>, std::cell::Cell<&ReLateBound(DebruijnIndex(0), BoundRegion { var: 0, kind: BrAnon }) u32>)),
40               (),
41           ]
42   = note: number of external vids: 2
43   = note: where '?1: '?0
44
45note: no external requirements
46  --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:28:1
47   |
48LL | fn case2() {
49   | ^^^^^^^^^^
50   |
51   = note: defining type: case2
52
53error[E0597]: `a` does not live long enough
54  --> $DIR/propagate-approximated-shorter-to-static-comparing-against-free.rs:30:26
55   |
56LL |       let a = 0;
57   |           - binding `a` declared here
58LL |       let cell = Cell::new(&a);
59   |                            ^^ borrowed value does not live long enough
60...
61LL | /     foo(cell, |cell_a, cell_x| {
62LL | |         cell_x.set(cell_a.get()); // forces 'a: 'x, implies 'a = 'static -> borrow error
63LL | |     })
64   | |______- argument requires that `a` is borrowed for `'static`
65LL |   }
66   |   - `a` dropped here while still borrowed
67
68error: aborting due to 2 previous errors
69
70Some errors have detailed explanations: E0521, E0597.
71For more information about an error, try `rustc --explain E0521`.