@@ -4,10 +4,10 @@ error[E0758]: cannot infer an appropriate lifetime
4
4
LL | fn elided(x: &i32) -> impl Copy { x }
5
5
| ---- --------- ^ ...and is captured here
6
6
| | |
7
- | | ...is required to live as long as `'static` by this ...
7
+ | | ...is required to live as long as `'static` here ...
8
8
| this data with an anonymous lifetime `'_`...
9
9
|
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
11
11
|
12
12
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
13
13
| ^^^^
@@ -18,10 +18,10 @@ error[E0758]: cannot infer an appropriate lifetime
18
18
LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
19
19
| ------- --------- ^ ...and is captured here
20
20
| | |
21
- | | ...is required to live as long as `'static` by this ...
21
+ | | ...is required to live as long as `'static` here ...
22
22
| this data with lifetime `'a`...
23
23
|
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
25
25
|
26
26
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
27
27
| ^^^^
@@ -32,14 +32,14 @@ error[E0758]: cannot infer an appropriate lifetime
32
32
LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
33
33
| ---- ------------------- ^ ...and is captured here
34
34
| | |
35
- | | ...is required to live as long as `'static` by this ...
35
+ | | ...is required to live as long as `'static` here ...
36
36
| this data with an anonymous lifetime `'_`...
37
37
|
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 `
39
39
|
40
40
LL | fn elided2(x: &i32) -> impl Copy + '_ { x }
41
41
| ^^
42
- help: alternatively, set an explicit `'static` lifetime to this parameter
42
+ help: alternatively, add an explicit `'static` bound to this reference
43
43
|
44
44
LL | fn elided2(x: &'static i32) -> impl Copy + 'static { x }
45
45
| ^^^^^^^^^^^^
@@ -50,14 +50,14 @@ error[E0758]: cannot infer an appropriate lifetime
50
50
LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'static { x }
51
51
| ------- ------------------- ^ ...and is captured here
52
52
| | |
53
- | | ...is required to live as long as `'static` by this ...
53
+ | | ...is required to live as long as `'static` here ...
54
54
| this data with lifetime `'a`...
55
55
|
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 `
57
57
|
58
58
LL | fn explicit2<'a>(x: &'a i32) -> impl Copy + 'a { x }
59
59
| ^^
60
- help: alternatively, set an explicit `'static` lifetime to this parameter
60
+ help: alternatively, add an explicit `'static` bound to this reference
61
61
|
62
62
LL | fn explicit2<'a>(x: &'static i32) -> impl Copy + 'static { x }
63
63
| ^^^^^^^^^^^^
@@ -76,14 +76,14 @@ error[E0758]: cannot infer an appropriate lifetime
76
76
LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'static { x }
77
77
| ------- -------------------------------- ^ ...and is captured here
78
78
| | |
79
- | | ...is required to live as long as `'static` by this ...
79
+ | | ...is required to live as long as `'static` here ...
80
80
| this data with lifetime `'a`...
81
81
|
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 `
83
83
|
84
84
LL | fn with_bound<'a>(x: &'a i32) -> impl LifetimeTrait<'a> + 'a { x }
85
85
| ^^
86
- help: alternatively, set an explicit `'static` lifetime to this parameter
86
+ help: alternatively, add an explicit `'static` bound to this reference
87
87
|
88
88
LL | fn with_bound<'a>(x: &'static i32) -> impl LifetimeTrait<'a> + 'static { x }
89
89
| ^^^^^^^^^^^^
@@ -109,11 +109,11 @@ error[E0758]: cannot infer an appropriate lifetime
109
109
--> $DIR/must_outlive_least_region_or_bound.rs:18:50
110
110
|
111
111
LL | 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`
113
113
| |
114
114
| this data with an anonymous lifetime `'_`...
115
115
|
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
117
117
|
118
118
LL | fn elided3(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
119
119
| ^^^^
@@ -122,11 +122,11 @@ error[E0758]: cannot infer an appropriate lifetime
122
122
--> $DIR/must_outlive_least_region_or_bound.rs:21:59
123
123
|
124
124
LL | 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`
126
126
| |
127
127
| this data with lifetime `'a`...
128
128
|
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
130
130
|
131
131
LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
132
132
| ^^^^
@@ -135,15 +135,15 @@ error[E0758]: cannot infer an appropriate lifetime
135
135
--> $DIR/must_outlive_least_region_or_bound.rs:24:60
136
136
|
137
137
LL | 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`
139
139
| |
140
140
| this data with an anonymous lifetime `'_`...
141
141
|
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 `
143
143
|
144
144
LL | fn elided4(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
145
145
| ^^
146
- help: alternatively, set an explicit `'static` lifetime in this parameter
146
+ help: alternatively, add an explicit `'static` bound to this reference
147
147
|
148
148
LL | fn elided4(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
149
149
| ^^^^^^^^^^^^
@@ -152,13 +152,13 @@ error[E0758]: cannot infer an appropriate lifetime
152
152
--> $DIR/must_outlive_least_region_or_bound.rs:27:69
153
153
|
154
154
LL | 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`
156
156
|
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 `
158
158
|
159
159
LL | fn explicit4<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
160
160
| ^^
161
- help: alternatively, set an explicit `'static` lifetime in this parameter
161
+ help: alternatively, add an explicit `'static` bound to this reference
162
162
|
163
163
LL | fn explicit4<'a>(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
164
164
| ^^^^^^^^^^^^
0 commit comments