1
- error: cannot infer an appropriate lifetime
1
+ error[E0758] : cannot infer an appropriate lifetime
2
2
--> $DIR/must_outlive_least_region_or_bound.rs:3:35
3
3
|
4
4
LL | fn elided(x: &i32) -> impl Copy { x }
5
5
| ---- --------- ^ ...and is captured here
6
6
| | |
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 `'_`...
9
9
|
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 `'_`
11
11
|
12
12
LL | fn elided(x: &i32) -> impl Copy + '_ { x }
13
13
| ^^^^
14
14
15
- error: cannot infer an appropriate lifetime
15
+ error[E0758] : cannot infer an appropriate lifetime
16
16
--> $DIR/must_outlive_least_region_or_bound.rs:6:44
17
17
|
18
18
LL | fn explicit<'a>(x: &'a i32) -> impl Copy { x }
19
19
| ------- --------- ^ ...and is captured here
20
20
| | |
21
- | | ...is required to be `'static` by this...
21
+ | | ...is required to live as long as `'static` by this...
22
22
| this data with lifetime `'a`...
23
23
|
24
24
help: to permit non-static references in an `impl Trait` value, you can add an explicit bound for lifetime `'a`
25
25
|
26
26
LL | fn explicit<'a>(x: &'a i32) -> impl Copy + 'a { x }
27
27
| ^^^^
28
28
29
- error: cannot infer an appropriate lifetime
29
+ error[E0758] : cannot infer an appropriate lifetime
30
30
--> $DIR/must_outlive_least_region_or_bound.rs:9:46
31
31
|
32
32
LL | fn elided2(x: &i32) -> impl Copy + 'static { x }
33
33
| ---- ------------------- ^ ...and is captured here
34
34
| | |
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 `'_`...
37
37
|
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 `'_`
39
39
|
40
40
LL | fn elided2(x: &i32) -> impl Copy + '_ { x }
41
41
| ^^
@@ -44,13 +44,13 @@ help: alternatively, set an explicit `'static` lifetime to this parameter
44
44
LL | fn elided2(x: &'static i32) -> impl Copy + 'static { x }
45
45
| ^^^^^^^^^^^^
46
46
47
- error: cannot infer an appropriate lifetime
47
+ error[E0758] : cannot infer an appropriate lifetime
48
48
--> $DIR/must_outlive_least_region_or_bound.rs:12:55
49
49
|
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 be `'static` by this...
53
+ | | ...is required to live as long as `'static` by this...
54
54
| this data with lifetime `'a`...
55
55
|
56
56
help: 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 }
70
70
| |
71
71
| help: add explicit lifetime `'a` to the type of `x`: `&'a i32`
72
72
73
- error: cannot infer an appropriate lifetime
73
+ error[E0758] : cannot infer an appropriate lifetime
74
74
--> $DIR/must_outlive_least_region_or_bound.rs:33:69
75
75
|
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 be `'static` by this...
79
+ | | ...is required to live as long as `'static` by this...
80
80
| this data with lifetime `'a`...
81
81
|
82
82
help: 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 {
105
105
| |
106
106
| help: consider adding an explicit lifetime bound...: `T: 'static +`
107
107
108
- error: cannot infer an appropriate lifetime
108
+ 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 with a `'static` requirement
112
+ | ---- ^ ...is captured here requiring it to live as long as `'static`
113
113
| |
114
- | this data with the anonymous lifetime `'_`...
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 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 `'_`
117
117
|
118
118
LL | fn elided3(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
119
119
| ^^^^
120
120
121
- error: cannot infer an appropriate lifetime
121
+ 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 with a `'static` requirement
125
+ | ------- ^ ...is captured here requiring it to live as long as `'static`
126
126
| |
127
127
| this data with lifetime `'a`...
128
128
|
@@ -131,15 +131,15 @@ help: to permit non-static references in a trait object value, you can add an ex
131
131
LL | fn explicit3<'a>(x: &'a i32) -> Box<dyn Debug + 'a> { Box::new(x) }
132
132
| ^^^^
133
133
134
- error: cannot infer an appropriate lifetime
134
+ 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 with a `'static` requirement
138
+ | ---- ^ ...is captured here requiring it to live as long as `'static`
139
139
| |
140
- | this data with the anonymous lifetime `'_`...
140
+ | this data with an anonymous lifetime `'_`...
141
141
|
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 `'_`
143
143
|
144
144
LL | fn elided4(x: &i32) -> Box<dyn Debug + '_> { Box::new(x) }
145
145
| ^^
@@ -148,11 +148,11 @@ help: alternatively, set an explicit `'static` lifetime in this parameter
148
148
LL | fn elided4(x: &'static i32) -> Box<dyn Debug + 'static> { Box::new(x) }
149
149
| ^^^^^^^^^^^^
150
150
151
- error: cannot infer an appropriate lifetime
151
+ 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 with a `'static` requirement
155
+ | ------- this data with lifetime `'a`... ^ ...is captured here requiring it to live as long as `'static`
156
156
|
157
157
help: consider changing the trait object's explicit `'static` bound to lifetime `'a`
158
158
|
0 commit comments