1
Fork 0

Make lifetime errors more precise in the presence of Fresh lifetimes.

This commit is contained in:
Camille GILLOT 2022-05-12 21:25:38 +02:00
parent 8da27078d3
commit da175c743c
27 changed files with 433 additions and 45 deletions

View file

@ -131,6 +131,17 @@ impl LifetimeName {
} }
} }
pub fn is_anonymous(&self) -> bool {
match *self {
LifetimeName::ImplicitObjectLifetimeDefault
| LifetimeName::Implicit
| LifetimeName::Underscore
| LifetimeName::Param(ParamName::Fresh(_))
| LifetimeName::Error => true,
LifetimeName::Static | LifetimeName::Param(_) => false,
}
}
pub fn is_elided(&self) -> bool { pub fn is_elided(&self) -> bool {
match self { match self {
LifetimeName::ImplicitObjectLifetimeDefault LifetimeName::ImplicitObjectLifetimeDefault

View file

@ -72,7 +72,7 @@ use rustc_middle::ty::{
subst::{GenericArgKind, Subst, SubstsRef}, subst::{GenericArgKind, Subst, SubstsRef},
Binder, EarlyBinder, List, Region, Ty, TyCtxt, TypeFoldable, Binder, EarlyBinder, List, Region, Ty, TyCtxt, TypeFoldable,
}; };
use rustc_span::{sym, BytePos, DesugaringKind, Pos, Span}; use rustc_span::{sym, symbol::kw, BytePos, DesugaringKind, Pos, Span};
use rustc_target::spec::abi; use rustc_target::spec::abi;
use std::ops::ControlFlow; use std::ops::ControlFlow;
use std::{cmp, fmt, iter}; use std::{cmp, fmt, iter};
@ -161,7 +161,12 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
{ {
sp = param.span; sp = param.span;
} }
(format!("the lifetime `{}` as defined here", br.name), sp) let text = if br.name == kw::UnderscoreLifetime {
format!("the anonymous lifetime as defined here")
} else {
format!("the lifetime `{}` as defined here", br.name)
};
(text, sp)
} }
ty::ReFree(ty::FreeRegion { ty::ReFree(ty::FreeRegion {
bound_region: ty::BoundRegionKind::BrNamed(_, name), .. bound_region: ty::BoundRegionKind::BrNamed(_, name), ..
@ -172,7 +177,12 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
{ {
sp = param.span; sp = param.span;
} }
(format!("the lifetime `{}` as defined here", name), sp) let text = if name == kw::UnderscoreLifetime {
format!("the anonymous lifetime as defined here")
} else {
format!("the lifetime `{}` as defined here", name)
};
(text, sp)
} }
ty::ReFree(ref fr) => match fr.bound_region { ty::ReFree(ref fr) => match fr.bound_region {
ty::BrAnon(idx) => { ty::BrAnon(idx) => {

View file

@ -12,6 +12,7 @@ use rustc_errors::{struct_span_err, Applicability, Diagnostic, ErrorGuaranteed};
use rustc_hir as hir; use rustc_hir as hir;
use rustc_hir::{GenericParamKind, Ty}; use rustc_hir::{GenericParamKind, Ty};
use rustc_middle::ty::Region; use rustc_middle::ty::Region;
use rustc_span::symbol::kw;
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// Print the error message for lifetime errors when both the concerned regions are anonymous. /// Print the error message for lifetime errors when both the concerned regions are anonymous.
@ -169,7 +170,7 @@ pub fn suggest_adding_lifetime_params<'tcx>(
return false; return false;
}; };
if !lifetime_sub.name.is_elided() || !lifetime_sup.name.is_elided() { if !lifetime_sub.name.is_anonymous() || !lifetime_sup.name.is_anonymous() {
return false; return false;
}; };
@ -188,31 +189,36 @@ pub fn suggest_adding_lifetime_params<'tcx>(
_ => return false, _ => return false,
}; };
let (suggestion_param_name, introduce_new) = generics let suggestion_param_name = generics
.params .params
.iter() .iter()
.find(|p| matches!(p.kind, GenericParamKind::Lifetime { .. })) .filter(|p| matches!(p.kind, GenericParamKind::Lifetime { .. }))
.and_then(|p| tcx.sess.source_map().span_to_snippet(p.span).ok()) .map(|p| p.name.ident().name)
.map(|name| (name, false)) .find(|i| *i != kw::UnderscoreLifetime);
.unwrap_or_else(|| ("'a".to_string(), true)); let introduce_new = suggestion_param_name.is_none();
let suggestion_param_name =
suggestion_param_name.map(|n| n.to_string()).unwrap_or_else(|| "'a".to_owned());
let mut suggestions = vec![ debug!(?lifetime_sup.span);
if let hir::LifetimeName::Underscore = lifetime_sub.name { debug!(?lifetime_sub.span);
(lifetime_sub.span, suggestion_param_name.clone()) let make_suggestion = |span: rustc_span::Span| {
if span.is_empty() {
(span, format!("{}, ", suggestion_param_name))
} else if let Ok("&") = tcx.sess.source_map().span_to_snippet(span).as_deref() {
(span.shrink_to_hi(), format!("{} ", suggestion_param_name))
} else { } else {
(lifetime_sub.span.shrink_to_hi(), suggestion_param_name.clone() + " ") (span, suggestion_param_name.clone())
}, }
if let hir::LifetimeName::Underscore = lifetime_sup.name { };
(lifetime_sup.span, suggestion_param_name.clone()) let mut suggestions =
} else { vec![make_suggestion(lifetime_sub.span), make_suggestion(lifetime_sup.span)];
(lifetime_sup.span.shrink_to_hi(), suggestion_param_name.clone() + " ")
},
];
if introduce_new { if introduce_new {
let new_param_suggestion = match &generics.params { let new_param_suggestion =
[] => (generics.span, format!("<{}>", suggestion_param_name)), if let Some(first) = generics.params.iter().find(|p| !p.name.ident().span.is_empty()) {
[first, ..] => (first.span.shrink_to_lo(), format!("{}, ", suggestion_param_name)), (first.span.shrink_to_lo(), format!("{}, ", suggestion_param_name))
} else {
(generics.span, format!("<{}>", suggestion_param_name))
}; };
suggestions.push(new_param_suggestion); suggestions.push(new_param_suggestion);

View file

@ -4,6 +4,7 @@ use crate::infer::error_reporting::nice_region_error::find_anon_type::find_anon_
use crate::infer::error_reporting::nice_region_error::NiceRegionError; use crate::infer::error_reporting::nice_region_error::NiceRegionError;
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed}; use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed};
use rustc_middle::ty; use rustc_middle::ty;
use rustc_span::symbol::kw;
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> { impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
/// When given a `ConcreteFailure` for a function with parameters containing a named region and /// When given a `ConcreteFailure` for a function with parameters containing a named region and
@ -67,7 +68,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
let is_impl_item = region_info.is_impl_item; let is_impl_item = region_info.is_impl_item;
match br { match br {
ty::BrAnon(_) => {} ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon(_) => {}
_ => { _ => {
/* not an anonymous region */ /* not an anonymous region */
debug!("try_report_named_anon_conflict: not an anonymous region"); debug!("try_report_named_anon_conflict: not an anonymous region");

View file

@ -5,6 +5,12 @@ LL | async fn fut(bufs: &mut [&mut [u8]]) {
| ---------------- these two types are declared with different lifetimes... | ---------------- these two types are declared with different lifetimes...
LL | ListFut(bufs).await LL | ListFut(bufs).await
| ^^^^ ...but data from `bufs` flows into `bufs` here | ^^^^ ...but data from `bufs` flows into `bufs` here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter
|
LL | async fn fut<'a>(bufs: &'a mut [&'a mut [u8]]) {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/issue-76547.rs:39:14 --> $DIR/issue-76547.rs:39:14
@ -13,6 +19,12 @@ LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
| ---------------- these two types are declared with different lifetimes... | ---------------- these two types are declared with different lifetimes...
LL | ListFut2(bufs).await LL | ListFut2(bufs).await
| ^^^^ ...but data from `bufs` flows into `bufs` here | ^^^^ ...but data from `bufs` flows into `bufs` here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter
|
LL | async fn fut2<'a>(bufs: &'a mut [&'a mut [u8]]) -> i32 {
| ++++ ++ ++
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -7,6 +7,11 @@ LL | async fn fut(bufs: &mut [&mut [u8]]) {
| let's call the lifetime of this reference `'1` | let's call the lifetime of this reference `'1`
LL | ListFut(bufs).await LL | ListFut(bufs).await
| ^^^^ this usage requires that `'1` must outlive `'2` | ^^^^ this usage requires that `'1` must outlive `'2`
|
help: consider introducing a named lifetime parameter
|
LL | async fn fut<'a>(bufs: &'a mut [&'a mut [u8]]) {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/issue-76547.rs:39:14 --> $DIR/issue-76547.rs:39:14
@ -17,6 +22,11 @@ LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
| let's call the lifetime of this reference `'1` | let's call the lifetime of this reference `'1`
LL | ListFut2(bufs).await LL | ListFut2(bufs).await
| ^^^^ this usage requires that `'1` must outlive `'2` | ^^^^ this usage requires that `'1` must outlive `'2`
|
help: consider introducing a named lifetime parameter
|
LL | async fn fut2<'a>(bufs: &'a mut [&'a mut [u8]]) -> i32 {
| ++++ ++ ++
error: aborting due to 2 previous errors error: aborting due to 2 previous errors

View file

@ -1,14 +1,12 @@
error[E0623]: lifetime mismatch error[E0621]: explicit lifetime required in the type of `foo`
--> $DIR/issue-63388-1.rs:19:9 --> $DIR/issue-63388-1.rs:19:9
| |
LL | &'a self, foo: &dyn Foo LL | &'a self, foo: &dyn Foo
| -------- this parameter and the return type are declared with different lifetimes... | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
LL | ) -> &dyn Foo
| --------
... ...
LL | foo LL | foo
| ^^^ ...but data from `foo` is returned here | ^^^ lifetime `'a` required
error: aborting due to previous error error: aborting due to previous error
For more information about this error, try `rustc --explain E0623`. For more information about this error, try `rustc --explain E0621`.

View file

@ -1,17 +1,16 @@
error: lifetime may not live long enough error[E0621]: explicit lifetime required in the type of `foo`
--> $DIR/issue-63388-1.rs:17:5 --> $DIR/issue-63388-1.rs:17:5
| |
LL | async fn do_sth<'a>(
| -- lifetime `'a` defined here
LL | &'a self, foo: &dyn Foo LL | &'a self, foo: &dyn Foo
| - let's call the lifetime of this reference `'1` | -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
LL | ) -> &dyn Foo LL | ) -> &dyn Foo
LL | / { LL | / {
LL | | LL | |
LL | | foo LL | | foo
LL | | LL | |
LL | | } LL | | }
| |_____^ associated function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'1` | |_____^ lifetime `'a` required
error: aborting due to previous error error: aborting due to previous error
For more information about this error, try `rustc --explain E0621`.

View file

@ -15,9 +15,9 @@ impl Xyz {
&'a self, foo: &dyn Foo &'a self, foo: &dyn Foo
) -> &dyn Foo ) -> &dyn Foo
{ {
//[nll]~^ ERROR lifetime may not live long enough //[nll]~^ ERROR explicit lifetime required in the type of `foo` [E0621]
foo foo
//[base]~^ ERROR lifetime mismatch //[base]~^ ERROR explicit lifetime required in the type of `foo` [E0621]
} }
} }

View file

@ -6,7 +6,7 @@ LL | impl Eq for &dyn DynEq {}
| |
= note: expected trait `<&dyn DynEq as PartialEq>` = note: expected trait `<&dyn DynEq as PartialEq>`
found trait `<&(dyn DynEq + 'static) as PartialEq>` found trait `<&(dyn DynEq + 'static) as PartialEq>`
note: the lifetime `'_` as defined here... note: the anonymous lifetime as defined here...
--> $DIR/E0308-2.rs:9:13 --> $DIR/E0308-2.rs:9:13
| |
LL | impl Eq for &dyn DynEq {} LL | impl Eq for &dyn DynEq {}

View file

@ -11,7 +11,7 @@ note: the anonymous lifetime defined here...
| |
LL | fn say(self: &Pair<&str, isize>) { LL | fn say(self: &Pair<&str, isize>) {
| ^^^^ | ^^^^
note: ...does not necessarily outlive the lifetime `'_` as defined here note: ...does not necessarily outlive the anonymous lifetime as defined here
--> $DIR/issue-17905-2.rs:5:5 --> $DIR/issue-17905-2.rs:5:5
| |
LL | &str, LL | &str,
@ -25,7 +25,7 @@ LL | fn say(self: &Pair<&str, isize>) {
| |
= note: expected struct `Pair<&str, _>` = note: expected struct `Pair<&str, _>`
found struct `Pair<&str, _>` found struct `Pair<&str, _>`
note: the lifetime `'_` as defined here... note: the anonymous lifetime as defined here...
--> $DIR/issue-17905-2.rs:5:5 --> $DIR/issue-17905-2.rs:5:5
| |
LL | &str, LL | &str,

View file

@ -6,7 +6,7 @@ LL | impl T1 for &dyn T2 {}
| |
= note: expected trait `<&dyn T2 as T0>` = note: expected trait `<&dyn T2 as T0>`
found trait `<&(dyn T2 + 'static) as T0>` found trait `<&(dyn T2 + 'static) as T0>`
note: the lifetime `'_` as defined here... note: the anonymous lifetime as defined here...
--> $DIR/issue-65230.rs:8:13 --> $DIR/issue-65230.rs:8:13
| |
LL | impl T1 for &dyn T2 {} LL | impl T1 for &dyn T2 {}

View file

@ -4,7 +4,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content...
LL | self.y = b.z LL | self.y = b.z
| ^^^ | ^^^
| |
note: ...the reference is valid for the lifetime `'_` as defined here... note: ...the reference is valid for the anonymous lifetime as defined here...
--> $DIR/issue-52742.rs:15:10 --> $DIR/issue-52742.rs:15:10
| |
LL | impl Foo<'_, '_> { LL | impl Foo<'_, '_> {

View file

@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content
| |
LL | Foo { bar } LL | Foo { bar }
| ^^^ | ^^^
note: but, the lifetime must be valid for the lifetime `'_` as defined here... note: but, the lifetime must be valid for the anonymous lifetime as defined here...
--> $DIR/issue-55394.rs:11:10 --> $DIR/issue-55394.rs:11:10
| |
LL | impl Foo<'_> { LL | impl Foo<'_> {

View file

@ -4,7 +4,7 @@ error[E0700]: hidden type for `impl Trait` captures lifetime that does not appea
LL | async fn f(self: Pin<&Self>) -> impl Clone { self } LL | async fn f(self: Pin<&Self>) -> impl Clone { self }
| - ^^^^^^^^ | - ^^^^^^^^
| | | |
| hidden type `Pin<&Foo>` captures the lifetime `'_` as defined here | hidden type `Pin<&Foo>` captures the anonymous lifetime as defined here
| |
help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound help: to declare that the `impl Trait` captures `'_`, you can add an explicit `'_` lifetime bound
| |

View file

@ -5,6 +5,12 @@ LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ---- ---- ^ ...but data from `f` is returned here | ---- ---- ^ ...but data from `f` is returned here
| | | |
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn a<'a>(self: Pin<&'a Foo>, f: &'a Foo) -> &Foo { f }
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:82 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:82
@ -13,6 +19,12 @@ LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (
| ---- ----------------- ^ ...but data from `f` is returned here | ---- ----------------- ^ ...but data from `f` is returned here
| | | |
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn c<'a>(self: Pin<&'a Self>, f: &'a Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64

View file

@ -6,6 +6,11 @@ LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| | | | | |
| | let's call the lifetime of this reference `'1` | | let's call the lifetime of this reference `'1`
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn a<'a>(self: Pin<&'a Foo>, f: &'a Foo) -> &Foo { f }
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:75 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:75
@ -15,6 +20,11 @@ LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (
| | | | | |
| | let's call the lifetime of this reference `'1` | | let's call the lifetime of this reference `'1`
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn c<'a>(self: Pin<&'a Self>, f: &'a Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64

View file

@ -7,6 +7,12 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:24:9 --> $DIR/lt-ref-self-async.rs:24:9
@ -17,6 +23,12 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:30:9 --> $DIR/lt-ref-self-async.rs:30:9
@ -27,6 +39,12 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:36:9 --> $DIR/lt-ref-self-async.rs:36:9
@ -37,6 +55,12 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:42:9 --> $DIR/lt-ref-self-async.rs:42:9
@ -47,6 +71,12 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:48:9 --> $DIR/lt-ref-self-async.rs:48:9
@ -57,6 +87,12 @@ LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -7,6 +7,11 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:24:9 --> $DIR/lt-ref-self-async.rs:24:9
@ -17,6 +22,11 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:30:9 --> $DIR/lt-ref-self-async.rs:30:9
@ -27,6 +37,11 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:36:9 --> $DIR/lt-ref-self-async.rs:36:9
@ -37,6 +52,11 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:42:9 --> $DIR/lt-ref-self-async.rs:42:9
@ -47,6 +67,11 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:48:9 --> $DIR/lt-ref-self-async.rs:48:9
@ -57,6 +82,11 @@ LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -7,6 +7,12 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:24:9 --> $DIR/ref-mut-self-async.rs:24:9
@ -17,6 +23,12 @@ LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:30:9 --> $DIR/ref-mut-self-async.rs:30:9
@ -27,6 +39,12 @@ LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:36:9 --> $DIR/ref-mut-self-async.rs:36:9
@ -37,6 +55,12 @@ LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:42:9 --> $DIR/ref-mut-self-async.rs:42:9
@ -47,6 +71,12 @@ LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a mut Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:48:9 --> $DIR/ref-mut-self-async.rs:48:9
@ -57,6 +87,12 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a mut Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -7,6 +7,11 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_self<'a>(&'a mut self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:24:9 --> $DIR/ref-mut-self-async.rs:24:9
@ -17,6 +22,11 @@ LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Self<'a>(self: &'a mut Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:30:9 --> $DIR/ref-mut-self-async.rs:30:9
@ -27,6 +37,11 @@ LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Self<'a>(self: Box<&'a mut Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:36:9 --> $DIR/ref-mut-self-async.rs:36:9
@ -37,6 +52,11 @@ LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Self<'a>(self: Pin<&'a mut Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:42:9 --> $DIR/ref-mut-self-async.rs:42:9
@ -47,6 +67,11 @@ LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a mut Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:48:9 --> $DIR/ref-mut-self-async.rs:48:9
@ -57,6 +82,11 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a mut Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -7,6 +7,12 @@ LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:22:9 --> $DIR/ref-mut-struct-async.rs:22:9
@ -17,6 +23,12 @@ LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:28:9 --> $DIR/ref-mut-struct-async.rs:28:9
@ -27,6 +39,12 @@ LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:34:9 --> $DIR/ref-mut-struct-async.rs:34:9
@ -37,6 +55,12 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a mut Struct>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:40:9 --> $DIR/ref-mut-struct-async.rs:40:9
@ -47,6 +71,12 @@ LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_ref_Struct<'a>(self: Box<Pin<&'a mut Struct>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -7,6 +7,11 @@ LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Struct<'a>(self: &'a mut Struct, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:22:9 --> $DIR/ref-mut-struct-async.rs:22:9
@ -17,6 +22,11 @@ LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Struct<'a>(self: Box<&'a mut Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:28:9 --> $DIR/ref-mut-struct-async.rs:28:9
@ -27,6 +37,11 @@ LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Struct<'a>(self: Pin<&'a mut Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:34:9 --> $DIR/ref-mut-struct-async.rs:34:9
@ -37,6 +52,11 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a mut Struct>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:40:9 --> $DIR/ref-mut-struct-async.rs:40:9
@ -47,6 +67,11 @@ LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_ref_Struct<'a>(self: Box<Pin<&'a mut Struct>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -7,6 +7,12 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:34:9 --> $DIR/ref-self-async.rs:34:9
@ -17,6 +23,12 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:40:9 --> $DIR/ref-self-async.rs:40:9
@ -27,6 +39,12 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:46:9 --> $DIR/ref-self-async.rs:46:9
@ -37,6 +55,12 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:52:9 --> $DIR/ref-self-async.rs:52:9
@ -47,6 +71,12 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:58:9 --> $DIR/ref-self-async.rs:58:9
@ -57,6 +87,12 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:64:9 --> $DIR/ref-self-async.rs:64:9
@ -67,6 +103,12 @@ LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn wrap_ref_Self_Self<'a>(self: Wrap<&'a Self, Self>, f: &'a u8) -> &u8 {
| ++++ ++ ++
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View file

@ -7,6 +7,11 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_self<'a>(&'a self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:34:9 --> $DIR/ref-self-async.rs:34:9
@ -17,6 +22,11 @@ LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Self<'a>(self: &'a Self, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:40:9 --> $DIR/ref-self-async.rs:40:9
@ -27,6 +37,11 @@ LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Self<'a>(self: Box<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:46:9 --> $DIR/ref-self-async.rs:46:9
@ -37,6 +52,11 @@ LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Self<'a>(self: Pin<&'a Self>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:52:9 --> $DIR/ref-self-async.rs:52:9
@ -47,6 +67,11 @@ LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Self<'a>(self: Box<Box<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:58:9 --> $DIR/ref-self-async.rs:58:9
@ -57,6 +82,11 @@ LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_ref_Self<'a>(self: Box<Pin<&'a Self>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:64:9 --> $DIR/ref-self-async.rs:64:9
@ -67,6 +97,11 @@ LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn wrap_ref_Self_Self<'a>(self: Wrap<&'a Self, Self>, f: &'a u8) -> &u8 {
| ++++ ++ ++
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View file

@ -7,6 +7,12 @@ LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:22:9 --> $DIR/ref-struct-async.rs:22:9
@ -17,6 +23,12 @@ LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:28:9 --> $DIR/ref-struct-async.rs:28:9
@ -27,6 +39,12 @@ LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:34:9 --> $DIR/ref-struct-async.rs:34:9
@ -37,6 +55,12 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a Struct>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:40:9 --> $DIR/ref-struct-async.rs:40:9
@ -47,6 +71,12 @@ LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| this parameter and the return type are declared with different lifetimes... | this parameter and the return type are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is returned here | ^ ...but data from `f` is returned here
|
= note: each elided lifetime in input position becomes a distinct lifetime
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_Struct<'a>(self: Box<Pin<&'a Struct>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -7,6 +7,11 @@ LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn ref_Struct<'a>(self: &'a Struct, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:22:9 --> $DIR/ref-struct-async.rs:22:9
@ -17,6 +22,11 @@ LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_ref_Struct<'a>(self: Box<&'a Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:28:9 --> $DIR/ref-struct-async.rs:28:9
@ -27,6 +37,11 @@ LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn pin_ref_Struct<'a>(self: Pin<&'a Struct>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:34:9 --> $DIR/ref-struct-async.rs:34:9
@ -37,6 +52,11 @@ LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_box_ref_Struct<'a>(self: Box<Box<&'a Struct>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: lifetime may not live long enough error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:40:9 --> $DIR/ref-struct-async.rs:40:9
@ -47,6 +67,11 @@ LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| let's call the lifetime of this reference `'2` | let's call the lifetime of this reference `'2`
LL | f LL | f
| ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1` | ^ associated function was supposed to return data with lifetime `'2` but it is returning data with lifetime `'1`
|
help: consider introducing a named lifetime parameter and update trait if needed
|
LL | async fn box_pin_Struct<'a>(self: Box<Pin<&'a Struct>>, f: &'a u32) -> &u32 {
| ++++ ++ ++
error: aborting due to 5 previous errors error: aborting due to 5 previous errors