]> git.lizzy.rs Git - rust.git/blob - tests/ui/nll/user-annotations/closure-substs.polonius.stderr
Auto merge of #105716 - chriswailes:ndk-update-redux, r=pietroalbini
[rust.git] / tests / ui / nll / user-annotations / closure-substs.polonius.stderr
1 error: lifetime may not live long enough
2   --> $DIR/closure-substs.rs:8:16
3    |
4 LL | fn foo<'a>() {
5    |        -- lifetime `'a` defined here
6 ...
7 LL |         return x;
8    |                ^ returning this value requires that `'a` must outlive `'static`
9    |
10    = help: consider replacing `'a` with `'static`
11
12 error: lifetime may not live long enough
13   --> $DIR/closure-substs.rs:15:16
14    |
15 LL |     |x: &i32| -> &'static i32 {
16    |         - let's call the lifetime of this reference `'1`
17 LL |         return x;
18    |                ^ returning this value requires that `'1` must outlive `'static`
19
20 error: lifetime may not live long enough
21   --> $DIR/closure-substs.rs:15:16
22    |
23 LL |     |x: &i32| -> &'static i32 {
24    |         -        - let's call the lifetime of this reference `'2`
25    |         |
26    |         let's call the lifetime of this reference `'1`
27 LL |         return x;
28    |                ^ returning this value requires that `'1` must outlive `'2`
29
30 error: lifetime may not live long enough
31   --> $DIR/closure-substs.rs:22:9
32    |
33 LL | fn bar<'a>() {
34    |        -- lifetime `'a` defined here
35 ...
36 LL |         b(x);
37    |         ^^^^ argument requires that `'a` must outlive `'static`
38    |
39    = help: consider replacing `'a` with `'static`
40
41 error[E0521]: borrowed data escapes outside of closure
42   --> $DIR/closure-substs.rs:29:9
43    |
44 LL |     |x: &i32, b: fn(&'static i32)| {
45    |      - `x` is a reference that is only valid in the closure body
46 LL |         b(x);
47    |         ^^^^ `x` escapes the closure body here
48
49 error[E0521]: borrowed data escapes outside of closure
50   --> $DIR/closure-substs.rs:29:9
51    |
52 LL |     |x: &i32, b: fn(&'static i32)| {
53    |      -        - `b` declared here, outside of the closure body
54    |      |
55    |      `x` is a reference that is only valid in the closure body
56 LL |         b(x);
57    |         ^^^^ `x` escapes the closure body here
58
59 error: aborting due to 6 previous errors
60
61 For more information about this error, try `rustc --explain E0521`.