@@ -4,10 +4,10 @@ error[E0758]: cannot infer an appropriate lifetime
44LL | fn elided(x: &i32) -> impl Copy { x }
55 | ---- --------- ^ ...and is captured here
66 | | |
7- | | ...is required to live as long as `'static` by this ...
7+ | | ...is required to live as long as `'static` here ...
88 | 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 an anonymous lifetime `'_`
10+ help: to declare that the `impl Trait` captures data from argument `x` , you can add an explicit `'_` lifetime bound
1111 |
1212LL | fn elided(x: &i32) -> impl Copy + '_ { x }
1313 | ^^^^
@@ -18,10 +18,10 @@ error[E0758]: cannot infer an appropriate lifetime
1818LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
1919 | ------- --------- ^ ...and is captured here
2020 | | |
21- | | ...is required to live as long as `'static` by this ...
21+ | | ...is required to live as long as `'static` here ...
2222 | this data with lifetime `'a`...
2323 |
24- help: to permit non-static references in an `impl Trait` value , you can add an explicit bound for lifetime `'a`
24+ help: to declare that the `impl Trait` captures data from argument `x` , you can add an explicit `'a` lifetime bound
2525 |
2626LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
2727 | ^^^^
@@ -32,14 +32,14 @@ error[E0758]: cannot infer an appropriate lifetime
3232LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
3333 | ---- ------------------- ^ ...and is captured here
3434 | | |
35- | | ...is required to live as long as `'static` by this ...
35+ | | ...is required to live as long as `'static` here ...
3636 | this data with an anonymous lifetime `'_`...
3737 |
38- help: consider changing the `impl Trait`'s explicit `'static` bound to an anonymous lifetime `'_ `
38+ help: consider changing the `impl Trait`'s explicit `'static` bound to argument `x `
3939 |
4040LL | fn elided2(x: &i32) -> impl Copy + '_ { x }
4141 | ^^
42- help: alternatively, set an explicit `'static` lifetime to this parameter
42+ help: alternatively, add an explicit `'static` bound to this reference
4343 |
4444LL | fn elided2(x: &'static i32) -> impl Copy + 'static { x }
4545 | ^^^^^^^^^^^^
@@ -50,14 +50,14 @@ error[E0758]: cannot infer an appropriate lifetime
5050LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
5151 | ------- ------------------- ^ ...and is captured here
5252 | | |
53- | | ...is required to live as long as `'static` by this ...
53+ | | ...is required to live as long as `'static` here ...
5454 | this data with lifetime `'a`...
5555 |
56- help: consider changing the `impl Trait`'s explicit `'static` bound to lifetime `'a `
56+ help: consider changing the `impl Trait`'s explicit `'static` bound to argument `x `
5757 |
5858LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'a { x }
5959 | ^^
60- help: alternatively, set an explicit `'static` lifetime to this parameter
60+ help: alternatively, add an explicit `'static` bound to this reference
6161 |
6262LL | fn explicit2<'a>(x: &'static i32) -> impl Copy + 'static { x }
6363 | ^^^^^^^^^^^^
@@ -76,14 +76,14 @@ error[E0758]: cannot infer an appropriate lifetime
7676LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
7777 | ------- -------------------------------- ^ ...and is captured here
7878 | | |
79- | | ...is required to live as long as `'static` by this ...
79+ | | ...is required to live as long as `'static` here ...
8080 | this data with lifetime `'a`...
8181 |
82- help: consider changing the `impl Trait`'s explicit `'static` bound to lifetime `'a `
82+ help: consider changing the `impl Trait`'s explicit `'static` bound to argument `x `
8383 |
8484LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'a { x }
8585 | ^^
86- help: alternatively, set an explicit `'static` lifetime to this parameter
86+ help: alternatively, add an explicit `'static` bound to this reference
8787 |
8888LL | fn with_bound<'a>(x: &'static i32) -> impl LifetimeTrait<'a> + 'static { x }
8989 | ^^^^^^^^^^^^
@@ -109,11 +109,11 @@ 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 requiring it to live as long as `'static`
112+ | ---- ^ ...is captured here, requiring it to live as long as `'static`
113113 | |
114114 | 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 an anonymous lifetime `'_`
116+ help: to declare that the trait object captures data from argument `x` , you can add an explicit `'_` lifetime bound
117117 |
118118LL | fn elided3(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
119119 | ^^^^
@@ -122,11 +122,11 @@ 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 requiring it to live as long as `'static`
125+ | ------- ^ ...is captured here, requiring it to live as long as `'static`
126126 | |
127127 | this data with lifetime `'a`...
128128 |
129- help: to permit non-static references in a trait object value , you can add an explicit bound for lifetime `'a`
129+ help: to declare that the trait object captures data from argument `x` , you can add an explicit `'a` lifetime bound
130130 |
131131LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
132132 | ^^^^
@@ -135,15 +135,15 @@ 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 requiring it to live as long as `'static`
138+ | ---- ^ ...is captured here, requiring it to live as long as `'static`
139139 | |
140140 | this data with an anonymous lifetime `'_`...
141141 |
142- help: consider changing the trait object's explicit `'static` bound to an anonymous lifetime `'_ `
142+ help: consider changing the trait object's explicit `'static` bound to argument `x `
143143 |
144144LL | fn elided4(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
145145 | ^^
146- help: alternatively, set an explicit `'static` lifetime in this parameter
146+ help: alternatively, add an explicit `'static` bound to this reference
147147 |
148148LL | fn elided4(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
149149 | ^^^^^^^^^^^^
@@ -152,13 +152,13 @@ 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 requiring it to live as long as `'static`
155+ | ------- this data with lifetime `'a`... ^ ...is captured here, requiring it to live as long as `'static`
156156 |
157- help: consider changing the trait object's explicit `'static` bound to lifetime `'a `
157+ help: consider changing the trait object's explicit `'static` bound to argument `x `
158158 |
159159LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
160160 | ^^
161- help: alternatively, set an explicit `'static` lifetime in this parameter
161+ help: alternatively, add an explicit `'static` bound to this reference
162162 |
163163LL | fn explicit4<'a>(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
164164 | ^^^^^^^^^^^^
0 commit comments