let return_sp = sub_origin.span();
let mut err = self.tcx.sess.struct_span_err(
sp,
- "can't infer an appropriate lifetime",
+ "cannot infer an appropriate lifetime",
);
- err.span_label(sp, "can't infer an appropriate lifetime");
err.span_label(
return_sp,
"this return type evaluates to the `'static` lifetime...",
fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
self.x.iter().map(|a| a.0)
}
- //~^^^ ERROR can't infer an appropriate lifetime
+ //~^^ ERROR cannot infer an appropriate lifetime
fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
self.x.iter().map(|a| a.0)
}
- //~^^^ ERROR can't infer an appropriate lifetime
+ //~^^ ERROR cannot infer an appropriate lifetime
}
fn main() {}
-error: can't infer an appropriate lifetime
+error: cannot infer an appropriate lifetime
--> $DIR/static-return-lifetime-infered.rs:17:16
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> {
| ----------------------- this return type evaluates to the `'static` lifetime...
LL | self.x.iter().map(|a| a.0)
- | ------ ^^^^ can't infer an appropriate lifetime
+ | ------ ^^^^
| |
| ...but this borrow...
|
LL | fn iter_values_anon(&self) -> impl Iterator<Item=u32> + '_ {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-error: can't infer an appropriate lifetime
+error: cannot infer an appropriate lifetime
--> $DIR/static-return-lifetime-infered.rs:21:16
|
LL | fn iter_values<'a>(&'a self) -> impl Iterator<Item=u32> {
| ----------------------- this return type evaluates to the `'static` lifetime...
LL | self.x.iter().map(|a| a.0)
- | ------ ^^^^ can't infer an appropriate lifetime
+ | ------ ^^^^
| |
| ...but this borrow...
|