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