fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
1.2 KiB40 linesraw
1error: lifetime may not live long enough
2  --> $DIR/closure-substs.rs:8: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   |
10   = help: consider replacing `'a` with `'static`
11
12error: lifetime may not live long enough
13  --> $DIR/closure-substs.rs:15:16
14   |
15LL |     |x: &i32| -> &'static i32 {
16   |         - let's call the lifetime of this reference `'1`
17LL |         return x;
18   |                ^ returning this value requires that `'1` must outlive `'static`
19
20error: lifetime may not live long enough
21  --> $DIR/closure-substs.rs:22:9
22   |
23LL | fn bar<'a>() {
24   |        -- lifetime `'a` defined here
25...
26LL |         b(x);
27   |         ^^^^ argument requires that `'a` must outlive `'static`
28   |
29   = help: consider replacing `'a` with `'static`
30
31error[E0521]: borrowed data escapes outside of closure
32  --> $DIR/closure-substs.rs:29:9
33   |
34LL |     |x: &i32, b: fn(&'static i32)| {
35   |      - `x` is a reference that is only valid in the closure body
36LL |         b(x);
37   |         ^^^^ `x` escapes the closure body here
38
39error: aborting due to 4 previous errors
40