1- error: cannot infer an appropriate lifetime
1+ error[E0758] : cannot infer an appropriate lifetime
22 --> $DIR/must_outlive_least_region_or_bound.rs:3:35
33 |
44LL | fn elided(x: &i32) -> impl Copy { x }
55 | ---- --------- ^ ...and is captured here
66 | | |
7- | | ...is required to be `'static` by this...
8- | this data with the anonymous lifetime `'_`...
7+ | | ...is required to live as long as `'static` by this...
8+ | this data with an anonymous lifetime `'_`...
99 |
10- help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for the anonymous lifetime `'_`
10+ help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for an anonymous lifetime `'_`
1111 |
1212LL | fn elided(x: &i32) -> impl Copy + '_ { x }
1313 | ^^^^
1414
15- error: cannot infer an appropriate lifetime
15+ error[E0758] : cannot infer an appropriate lifetime
1616 --> $DIR/must_outlive_least_region_or_bound.rs:6:44
1717 |
1818LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
1919 | ------- --------- ^ ...and is captured here
2020 | | |
21- | | ...is required to be `'static` by this...
21+ | | ...is required to live as long as `'static` by this...
2222 | this data with lifetime `'a`...
2323 |
2424help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for lifetime `'a`
2525 |
2626LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
2727 | ^^^^
2828
29- error: cannot infer an appropriate lifetime
29+ error[E0758] : cannot infer an appropriate lifetime
3030 --> $DIR/must_outlive_least_region_or_bound.rs:9:46
3131 |
3232LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
3333 | ---- ------------------- ^ ...and is captured here
3434 | | |
35- | | ...is required to be `'static` by this...
36- | this data with the anonymous lifetime `'_`...
35+ | | ...is required to live as long as `'static` by this...
36+ | this data with an anonymous lifetime `'_`...
3737 |
38- help: consider changing the `impl Trait`'s explicit `'static` bound to the anonymous lifetime `'_`
38+ help: consider changing the `impl Trait`'s explicit `'static` bound to an anonymous lifetime `'_`
3939 |
4040LL | fn elided2(x: &i32) -> impl Copy + '_ { x }
4141 | ^^
@@ -44,13 +44,13 @@ help: alternatively, set an explicit `'static` lifetime to this parameter
4444LL | fn elided2(x: &'static i32) -> impl Copy + 'static { x }
4545 | ^^^^^^^^^^^^
4646
47- error: cannot infer an appropriate lifetime
47+ error[E0758] : cannot infer an appropriate lifetime
4848 --> $DIR/must_outlive_least_region_or_bound.rs:12:55
4949 |
5050LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
5151 | ------- ------------------- ^ ...and is captured here
5252 | | |
53- | | ...is required to be `'static` by this...
53+ | | ...is required to live as long as `'static` by this...
5454 | this data with lifetime `'a`...
5555 |
5656help: consider changing the `impl Trait`'s explicit `'static` bound to lifetime `'a`
@@ -70,13 +70,13 @@ LL | fn foo<'a>(x: &i32) -> impl Copy + 'a { x }
7070 | |
7171 | help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
7272
73- error: cannot infer an appropriate lifetime
73+ error[E0758] : cannot infer an appropriate lifetime
7474 --> $DIR/must_outlive_least_region_or_bound.rs:33:69
7575 |
7676LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
7777 | ------- -------------------------------- ^ ...and is captured here
7878 | | |
79- | | ...is required to be `'static` by this...
79+ | | ...is required to live as long as `'static` by this...
8080 | this data with lifetime `'a`...
8181 |
8282help: consider changing the `impl Trait`'s explicit `'static` bound to lifetime `'a`
@@ -105,24 +105,24 @@ LL | fn ty_param_wont_outlive_static<T:Debug>(x: T) -> impl Debug + 'static {
105105 | |
106106 | help: consider adding an explicit lifetime bound...: `T: 'static +`
107107
108- error: cannot infer an appropriate lifetime
108+ error[E0758] : cannot infer an appropriate lifetime
109109 --> $DIR/must_outlive_least_region_or_bound.rs:18:50
110110 |
111111LL | fn elided3(x: &i32) -> Box<dyn Debug> { Box::new(x) }
112- | ---- ^ ...is captured here with a `'static` requirement
112+ | ---- ^ ...is captured here requiring it to live as long as `'static`
113113 | |
114- | this data with the anonymous lifetime `'_`...
114+ | this data with an anonymous lifetime `'_`...
115115 |
116- help: to permit non-static references in a trait object value, you can add an explicit bound for the anonymous lifetime `'_`
116+ help: to permit non-static references in a trait object value, you can add an explicit bound for an anonymous lifetime `'_`
117117 |
118118LL | fn elided3(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
119119 | ^^^^
120120
121- error: cannot infer an appropriate lifetime
121+ error[E0758] : cannot infer an appropriate lifetime
122122 --> $DIR/must_outlive_least_region_or_bound.rs:21:59
123123 |
124124LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug> { Box::new(x) }
125- | ------- ^ ...is captured here with a `'static` requirement
125+ | ------- ^ ...is captured here requiring it to live as long as `'static`
126126 | |
127127 | this data with lifetime `'a`...
128128 |
@@ -131,15 +131,15 @@ help: to permit non-static references in a trait object value, you can add an ex
131131LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
132132 | ^^^^
133133
134- error: cannot infer an appropriate lifetime
134+ error[E0758] : cannot infer an appropriate lifetime
135135 --> $DIR/must_outlive_least_region_or_bound.rs:24:60
136136 |
137137LL | fn elided4(x: &i32) -> Box<dyn Debug + 'static> { Box::new(x) }
138- | ---- ^ ...is captured here with a `'static` requirement
138+ | ---- ^ ...is captured here requiring it to live as long as `'static`
139139 | |
140- | this data with the anonymous lifetime `'_`...
140+ | this data with an anonymous lifetime `'_`...
141141 |
142- help: consider changing the trait object's explicit `'static` bound to the anonymous lifetime `'_`
142+ help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_`
143143 |
144144LL | fn elided4(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
145145 | ^^
@@ -148,11 +148,11 @@ help: alternatively, set an explicit `'static` lifetime in this parameter
148148LL | fn elided4(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
149149 | ^^^^^^^^^^^^
150150
151- error: cannot infer an appropriate lifetime
151+ error[E0758] : cannot infer an appropriate lifetime
152152 --> $DIR/must_outlive_least_region_or_bound.rs:27:69
153153 |
154154LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'static> { Box::new(x) }
155- | ------- this data with lifetime `'a`... ^ ...is captured here with a `'static` requirement
155+ | ------- this data with lifetime `'a`... ^ ...is captured here requiring it to live as long as `'static`
156156 |
157157help: consider changing the trait object's explicit `'static` bound to lifetime `'a`
158158 |
0 commit comments