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