Make lifetime errors more precise in the presence of Fresh
lifetimes.
This commit is contained in:
parent
8da27078d3
commit
da175c743c
@ -131,6 +131,17 @@ pub fn ident(&self) -> Ident {
|
||||
}
|
||||
}
|
||||
|
||||
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 {
|
||||
match self {
|
||||
LifetimeName::ImplicitObjectLifetimeDefault
|
||||
|
@ -72,7 +72,7 @@
|
||||
subst::{GenericArgKind, Subst, SubstsRef},
|
||||
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 std::ops::ControlFlow;
|
||||
use std::{cmp, fmt, iter};
|
||||
@ -161,7 +161,12 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
|
||||
{
|
||||
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 {
|
||||
bound_region: ty::BoundRegionKind::BrNamed(_, name), ..
|
||||
@ -172,7 +177,12 @@ fn msg_span_from_early_bound_and_free_regions<'tcx>(
|
||||
{
|
||||
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::BrAnon(idx) => {
|
||||
|
@ -12,6 +12,7 @@
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::{GenericParamKind, Ty};
|
||||
use rustc_middle::ty::Region;
|
||||
use rustc_span::symbol::kw;
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
/// 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;
|
||||
};
|
||||
|
||||
if !lifetime_sub.name.is_elided() || !lifetime_sup.name.is_elided() {
|
||||
if !lifetime_sub.name.is_anonymous() || !lifetime_sup.name.is_anonymous() {
|
||||
return false;
|
||||
};
|
||||
|
||||
@ -188,32 +189,37 @@ pub fn suggest_adding_lifetime_params<'tcx>(
|
||||
_ => return false,
|
||||
};
|
||||
|
||||
let (suggestion_param_name, introduce_new) = generics
|
||||
let suggestion_param_name = generics
|
||||
.params
|
||||
.iter()
|
||||
.find(|p| matches!(p.kind, GenericParamKind::Lifetime { .. }))
|
||||
.and_then(|p| tcx.sess.source_map().span_to_snippet(p.span).ok())
|
||||
.map(|name| (name, false))
|
||||
.unwrap_or_else(|| ("'a".to_string(), true));
|
||||
.filter(|p| matches!(p.kind, GenericParamKind::Lifetime { .. }))
|
||||
.map(|p| p.name.ident().name)
|
||||
.find(|i| *i != kw::UnderscoreLifetime);
|
||||
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![
|
||||
if let hir::LifetimeName::Underscore = lifetime_sub.name {
|
||||
(lifetime_sub.span, suggestion_param_name.clone())
|
||||
debug!(?lifetime_sup.span);
|
||||
debug!(?lifetime_sub.span);
|
||||
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 {
|
||||
(lifetime_sub.span.shrink_to_hi(), suggestion_param_name.clone() + " ")
|
||||
},
|
||||
if let hir::LifetimeName::Underscore = lifetime_sup.name {
|
||||
(lifetime_sup.span, suggestion_param_name.clone())
|
||||
} else {
|
||||
(lifetime_sup.span.shrink_to_hi(), suggestion_param_name.clone() + " ")
|
||||
},
|
||||
];
|
||||
(span, suggestion_param_name.clone())
|
||||
}
|
||||
};
|
||||
let mut suggestions =
|
||||
vec![make_suggestion(lifetime_sub.span), make_suggestion(lifetime_sup.span)];
|
||||
|
||||
if introduce_new {
|
||||
let new_param_suggestion = match &generics.params {
|
||||
[] => (generics.span, format!("<{}>", suggestion_param_name)),
|
||||
[first, ..] => (first.span.shrink_to_lo(), format!("{}, ", suggestion_param_name)),
|
||||
};
|
||||
let new_param_suggestion =
|
||||
if let Some(first) = generics.params.iter().find(|p| !p.name.ident().span.is_empty()) {
|
||||
(first.span.shrink_to_lo(), format!("{}, ", suggestion_param_name))
|
||||
} else {
|
||||
(generics.span, format!("<{}>", suggestion_param_name))
|
||||
};
|
||||
|
||||
suggestions.push(new_param_suggestion);
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
|
||||
use rustc_errors::{struct_span_err, Applicability, DiagnosticBuilder, ErrorGuaranteed};
|
||||
use rustc_middle::ty;
|
||||
use rustc_span::symbol::kw;
|
||||
|
||||
impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
||||
/// When given a `ConcreteFailure` for a function with parameters containing a named region and
|
||||
@ -67,7 +68,7 @@ pub(super) fn try_report_named_anon_conflict(
|
||||
let is_impl_item = region_info.is_impl_item;
|
||||
|
||||
match br {
|
||||
ty::BrAnon(_) => {}
|
||||
ty::BrNamed(_, kw::UnderscoreLifetime) | ty::BrAnon(_) => {}
|
||||
_ => {
|
||||
/* not an anonymous region */
|
||||
debug!("try_report_named_anon_conflict: not an anonymous region");
|
||||
|
@ -5,6 +5,12 @@ LL | async fn fut(bufs: &mut [&mut [u8]]) {
|
||||
| ---------------- these two types are declared with different lifetimes...
|
||||
LL | ListFut(bufs).await
|
||||
| ^^^^ ...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
|
||||
--> $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...
|
||||
LL | ListFut2(bufs).await
|
||||
| ^^^^ ...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
|
||||
|
||||
|
@ -7,6 +7,11 @@ LL | async fn fut(bufs: &mut [&mut [u8]]) {
|
||||
| let's call the lifetime of this reference `'1`
|
||||
LL | ListFut(bufs).await
|
||||
| ^^^^ 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
|
||||
--> $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`
|
||||
LL | ListFut2(bufs).await
|
||||
| ^^^^ 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
|
||||
|
||||
|
@ -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
|
||||
|
|
||||
LL | &'a self, foo: &dyn Foo
|
||||
| -------- this parameter and the return type are declared with different lifetimes...
|
||||
LL | ) -> &dyn Foo
|
||||
| --------
|
||||
| -------- help: add explicit lifetime `'a` to the type of `foo`: `&'a (dyn Foo + 'a)`
|
||||
...
|
||||
LL | foo
|
||||
| ^^^ ...but data from `foo` is returned here
|
||||
| ^^^ lifetime `'a` required
|
||||
|
||||
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`.
|
||||
|
@ -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
|
||||
|
|
||||
LL | async fn do_sth<'a>(
|
||||
| -- lifetime `'a` defined here
|
||||
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 | / {
|
||||
LL | |
|
||||
LL | | foo
|
||||
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
|
||||
|
||||
For more information about this error, try `rustc --explain E0621`.
|
||||
|
@ -15,9 +15,9 @@ async fn do_sth<'a>(
|
||||
&'a self, 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
|
||||
//[base]~^ ERROR lifetime mismatch
|
||||
//[base]~^ ERROR explicit lifetime required in the type of `foo` [E0621]
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ LL | impl Eq for &dyn DynEq {}
|
||||
|
|
||||
= note: expected trait `<&dyn DynEq 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
|
||||
|
|
||||
LL | impl Eq for &dyn DynEq {}
|
||||
|
@ -11,7 +11,7 @@ note: the anonymous lifetime defined here...
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | &str,
|
||||
@ -25,7 +25,7 @@ LL | fn say(self: &Pair<&str, isize>) {
|
||||
|
|
||||
= note: expected 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
|
||||
|
|
||||
LL | &str,
|
||||
|
@ -6,7 +6,7 @@ LL | impl T1 for &dyn T2 {}
|
||||
|
|
||||
= note: expected trait `<&dyn T2 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
|
||||
|
|
||||
LL | impl T1 for &dyn T2 {}
|
||||
|
@ -4,7 +4,7 @@ error[E0312]: lifetime of reference outlives lifetime of borrowed content...
|
||||
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
|
||||
|
|
||||
LL | impl Foo<'_, '_> {
|
||||
|
@ -14,7 +14,7 @@ note: ...so that reference does not outlive borrowed content
|
||||
|
|
||||
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
|
||||
|
|
||||
LL | impl Foo<'_> {
|
||||
|
@ -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 }
|
||||
| - ^^^^^^^^
|
||||
| |
|
||||
| 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
|
||||
|
|
||||
|
@ -5,6 +5,12 @@ LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
|
||||
| ---- ---- ^ ...but data from `f` is returned here
|
||||
| |
|
||||
| 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
|
||||
--> $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
|
||||
| |
|
||||
| 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
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64
|
||||
|
@ -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 `'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
|
||||
--> $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 `'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
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:22:64
|
||||
|
@ -7,6 +7,12 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
|
||||
|
@ -7,6 +7,11 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| let's call the lifetime of this reference `'2`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
|
||||
|
@ -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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
|
||||
|
@ -7,6 +7,11 @@ LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
|
||||
| let's call the lifetime of this reference `'2`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
|
||||
|
@ -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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
|
||||
|
@ -7,6 +7,11 @@ LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
|
||||
| let's call the lifetime of this reference `'2`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
|
||||
|
@ -7,6 +7,12 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| this parameter and the return type are declared with different lifetimes...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
|
||||
|
@ -7,6 +7,11 @@ LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| let's call the lifetime of this reference `'2`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
|
||||
|
@ -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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
--> $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...
|
||||
LL | f
|
||||
| ^ ...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
|
||||
|
||||
|
@ -7,6 +7,11 @@ LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| let's call the lifetime of this reference `'2`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
--> $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`
|
||||
LL | f
|
||||
| ^ 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
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user