]> git.lizzy.rs Git - rust.git/blob - src/test/ui/impl-trait/must_outlive_least_region_or_bound.nll.stderr
Rollup merge of #87346 - rylev:rename-force-warn, r=nikomatsakis
[rust.git] / src / test / ui / impl-trait / must_outlive_least_region_or_bound.nll.stderr
1 error: lifetime may not live long enough
2   --> $DIR/must_outlive_least_region_or_bound.rs:3:23
3    |
4 LL | fn elided(x: &i32) -> impl Copy { x }
5    |              -        ^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
6    |              |
7    |              let's call the lifetime of this reference `'1`
8    |
9 help: to allow this `impl Trait` to capture borrowed data with lifetime `'1`, add `'_` as a bound
10    |
11 LL | fn elided(x: &i32) -> impl Copy + '_ { x }
12    |                                 ^^^^
13
14 error: lifetime may not live long enough
15   --> $DIR/must_outlive_least_region_or_bound.rs:5:32
16    |
17 LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
18    |             --                 ^^^^^^^^^ opaque type requires that `'a` must outlive `'static`
19    |             |
20    |             lifetime `'a` defined here
21    |
22    = help: consider replacing `'a` with `'static`
23 help: to allow this `impl Trait` to capture borrowed data with lifetime `'a`, add `'a` as a bound
24    |
25 LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
26    |                                          ^^^^
27
28 error: lifetime may not live long enough
29   --> $DIR/must_outlive_least_region_or_bound.rs:7:46
30    |
31 LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
32    |               -                              ^ returning this value requires that `'1` must outlive `'static`
33    |               |
34    |               let's call the lifetime of this reference `'1`
35    |
36    = help: consider replacing `'1` with `'static`
37
38 error: lifetime may not live long enough
39   --> $DIR/must_outlive_least_region_or_bound.rs:9:55
40    |
41 LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
42    |              -- lifetime `'a` defined here            ^ returning this value requires that `'a` must outlive `'static`
43    |
44    = help: consider replacing `'a` with `'static`
45    = help: consider replacing `'a` with `'static`
46
47 error[E0621]: explicit lifetime required in the type of `x`
48   --> $DIR/must_outlive_least_region_or_bound.rs:11:41
49    |
50 LL | fn foo<'a>(x: &i32) -> impl Copy + 'a { x }
51    |               ----                      ^ lifetime `'a` required
52    |               |
53    |               help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
54
55 error: lifetime may not live long enough
56   --> $DIR/must_outlive_least_region_or_bound.rs:22:24
57    |
58 LL | fn elided5(x: &i32) -> (Box<dyn Debug>, impl Debug) { (Box::new(x), x) }
59    |               -        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ opaque type requires that `'1` must outlive `'static`
60    |               |
61    |               let's call the lifetime of this reference `'1`
62
63 error: lifetime may not live long enough
64   --> $DIR/must_outlive_least_region_or_bound.rs:28:69
65    |
66 LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
67    |               -- lifetime `'a` defined here                         ^ returning this value requires that `'a` must outlive `'static`
68    |
69    = help: consider replacing `'a` with `'static`
70    = help: consider replacing `'a` with `'static`
71
72 error: lifetime may not live long enough
73   --> $DIR/must_outlive_least_region_or_bound.rs:32:61
74    |
75 LL | fn move_lifetime_into_fn<'a, 'b>(x: &'a u32, y: &'b u32) -> impl Fn(&'a u32) {
76    |                          --  -- lifetime `'b` defined here  ^^^^^^^^^^^^^^^^ opaque type requires that `'b` must outlive `'a`
77    |                          |
78    |                          lifetime `'a` defined here
79    |
80    = help: consider adding the following bound: `'b: 'a`
81
82 error[E0310]: the parameter type `T` may not live long enough
83   --> $DIR/must_outlive_least_region_or_bound.rs:37:51
84    |
85 LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
86    |                                                   ^^^^^^^^^^^^^^^^^^^^
87    |
88    = help: consider adding an explicit lifetime bound `T: 'static`...
89
90 error: aborting due to 9 previous errors
91
92 Some errors have detailed explanations: E0310, E0621.
93 For more information about an error, try `rustc --explain E0310`.