]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
Change NLL compare mode to borrowck=migrate.
[rust.git] / src / test / ui / impl-trait / must_outlive_least_region_or_bound.nll.stderr
1 error[E0621]: explicit lifetime required in the type of `x`
2   --> $DIR/must_outlive_least_region_or_bound.rs:13:35
3    |
4 LL | fn elided(x: &i32) -> impl Copy { x }
5    |              ----                 ^ lifetime `'static` required
6    |              |
7    |              help: add explicit lifetime `'static` to the type of `x`: `&'static i32`
8
9 error: unsatisfied lifetime constraints
10   --> $DIR/must_outlive_least_region_or_bound.rs:16:44
11    |
12 LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
13    |             -- lifetime `'a` defined here  ^ returning this value requires that `'a` must outlive `'static`
14 help: to allow this impl Trait to capture borrowed data with lifetime `'a`, add `'a` as a constraint
15    |
16 LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
17    |                                ^^^^^^^^^^^^^^
18
19 error: unsatisfied lifetime constraints
20   --> $DIR/must_outlive_least_region_or_bound.rs:22:69
21    |
22 LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
23    |               -- lifetime `'a` defined here                         ^ returning this value requires that `'a` must outlive `'static`
24    |
25    = help: consider replacing `'a` with `'static`
26
27 error: unsatisfied lifetime constraints
28   --> $DIR/must_outlive_least_region_or_bound.rs:29:5
29    |
30 LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
31    |                          --  -- lifetime `'b` defined here
32    |                          |
33    |                          lifetime `'a` defined here
34 LL |     //~^ ERROR lifetime mismatch
35 LL |     move |_| println!("{}", y)
36    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'b`
37
38 error[E0310]: the parameter type `T` may not live long enough
39   --> $DIR/must_outlive_least_region_or_bound.rs:32:51
40    |
41 LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
42    |                                                   ^^^^^^^^^^^^^^^^^^^^
43    |
44    = help: consider adding an explicit lifetime bound `T: 'static`...
45
46 error: aborting due to 5 previous errors
47
48 Some errors occurred: E0310, E0621.
49 For more information about an error, try `rustc --explain E0310`.