fork/rust

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

borsAuto merge of #67350 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum73528e339aa

1.40.0
1.1 KiB36 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
10error: lifetime may not live long enough
11  --> $DIR/closure-substs.rs:15: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:22: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:29:9
29   |
30LL |     |x: &i32, b: fn(&'static i32)| {
31   |      - `x` is a reference that is only valid in the closure body
32LL |         b(x);
33   |         ^^^^ `x` escapes the closure body here
34
35error: aborting due to 4 previous errors
36