fork/rust

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

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

master
1.3 KiB42 linesraw
1error: lifetime may not live long enough
2  --> $DIR/closure-substs.rs:6:16
3   |
4LL | fn foo<'a>() {
5   |        -- lifetime `'a` defined here
6...
7LL |         return x;
8   |                ^ returning this value requires that `'a` must outlive `'static`
9
10error: lifetime may not live long enough
11  --> $DIR/closure-substs.rs:13:16
12   |
13LL |     |x: &i32| -> &'static i32 {
14   |         - let's call the lifetime of this reference `'1`
15LL |         return x;
16   |                ^ returning this value requires that `'1` must outlive `'static`
17
18error: lifetime may not live long enough
19  --> $DIR/closure-substs.rs:20:9
20   |
21LL | fn bar<'a>() {
22   |        -- lifetime `'a` defined here
23...
24LL |         b(x);
25   |         ^^^^ argument requires that `'a` must outlive `'static`
26
27error[E0521]: borrowed data escapes outside of closure
28  --> $DIR/closure-substs.rs:27:9
29   |
30LL |     |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
34LL |         b(x);
35   |         ^^^^
36   |         |
37   |         `x` escapes the closure body here
38   |         argument requires that `'1` must outlive `'static`
39
40error: aborting due to 4 previous errors
41
42For more information about this error, try `rustc --explain E0521`.