1
Fork 0

Simplify error reporting code, remove await point wording

This commit is contained in:
Tyler Mandry 2021-12-10 00:01:05 +00:00
parent 5c15ad7fca
commit 698631e16c
10 changed files with 135 additions and 268 deletions

View file

@ -106,91 +106,47 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
None => String::new(), None => String::new(),
}; };
let (span_1, span_2, main_label, span_label, future_return_type) = debug!(
match (sup_is_ret_type, sub_is_ret_type) { "try_report_anon_anon_conflict: sub_is_ret_type={:?} sup_is_ret_type={:?}",
(None, None) => { sub_is_ret_type, sup_is_ret_type
let (main_label_1, span_label_1) = if ty_sup.hir_id == ty_sub.hir_id { );
(
"this type is declared with multiple lifetimes...".to_owned(),
"...but data with one lifetime flows into the other here".to_owned(),
)
} else {
(
"these two types are declared with different lifetimes...".to_owned(),
format!("...but data{} flows{} here", span_label_var1, span_label_var2),
)
};
(ty_sup.span, ty_sub.span, main_label_1, span_label_1, None)
}
(Some(ret_span), _) => {
let sup_future = self.future_return_type(scope_def_id_sup);
let (return_type, action) = if sup_future.is_some() {
("returned future", "held across an await point")
} else {
("return type", "returned")
};
(
ty_sub.span,
ret_span,
format!(
"this parameter and the {} are declared with different lifetimes...",
return_type
),
format!("...but data{} is {} here", span_label_var1, action),
sup_future,
)
}
(_, Some(ret_span)) => {
let sub_future = self.future_return_type(scope_def_id_sub);
let (return_type, action) = if sub_future.is_some() {
("returned future", "held across an await point")
} else {
("return type", "returned")
};
(
ty_sup.span,
ret_span,
format!(
"this parameter and the {} are declared with different lifetimes...",
return_type
),
format!("...but data{} is {} here", span_label_var1, action),
sub_future,
)
}
};
let mut err = struct_span_err!(self.tcx().sess, span, E0623, "lifetime mismatch"); let mut err = struct_span_err!(self.tcx().sess, span, E0623, "lifetime mismatch");
err.span_label(span_1, main_label); match (sup_is_ret_type, sub_is_ret_type) {
err.span_label(span_2, String::new()); (ret_capture @ Some(ret_span), _) | (_, ret_capture @ Some(ret_span)) => {
err.span_label(span, span_label); let param_span =
if sup_is_ret_type == ret_capture { ty_sub.span } else { ty_sup.span };
err.span_label(
param_span,
"this parameter and the return type are declared with different lifetimes...",
);
err.span_label(ret_span, "");
err.span_label(span, format!("...but data{} is returned here", span_label_var1));
}
(None, None) => {
if ty_sup.hir_id == ty_sub.hir_id {
err.span_label(ty_sup.span, "this type is declared with multiple lifetimes...");
err.span_label(ty_sub.span, "");
err.span_label(span, "...but data with one lifetime flows into the other here");
} else {
err.span_label(
ty_sup.span,
"these two types are declared with different lifetimes...",
);
err.span_label(ty_sub.span, "");
err.span_label(
span,
format!("...but data{} flows{} here", span_label_var1, span_label_var2),
);
}
}
}
self.suggest_adding_lifetime_params(sub, ty_sup, ty_sub, &mut err); self.suggest_adding_lifetime_params(sub, ty_sup, ty_sub, &mut err);
// TODO: This is only helpful if the lifetime more visible in the impl Future type than in the signature.
if let Some(t) = future_return_type {
let snip = self
.tcx()
.sess
.source_map()
.span_to_snippet(t.span)
.ok()
.and_then(|s| match (&t.kind, s.as_str()) {
(rustc_hir::TyKind::Tup(&[]), "") => Some("()".to_string()),
(_, "") => None,
_ => Some(s),
})
.unwrap_or_else(|| "{unnamed_type}".to_string());
err.span_label(
t.span,
&format!("this `async fn` implicitly returns an `impl Future<Output = {}>`", snip),
);
}
err.emit(); err.emit();
Some(ErrorReported) Some(ErrorReported)
} }

View file

@ -94,60 +94,6 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
}) })
} }
pub(super) fn future_return_type(
&self,
local_def_id: LocalDefId,
) -> Option<&rustc_hir::Ty<'_>> {
if let Some(hir::IsAsync::Async) = self.asyncness(local_def_id) {
if let rustc_middle::ty::Opaque(def_id, _) =
self.tcx().type_of(local_def_id).fn_sig(self.tcx()).output().skip_binder().kind()
{
match self.tcx().hir().get_if_local(*def_id) {
Some(hir::Node::Item(hir::Item {
kind:
hir::ItemKind::OpaqueTy(hir::OpaqueTy {
bounds,
origin: hir::OpaqueTyOrigin::AsyncFn(..),
..
}),
..
})) => {
for b in bounds.iter() {
if let hir::GenericBound::LangItemTrait(
hir::LangItem::Future,
_span,
_hir_id,
generic_args,
) = b
{
for type_binding in generic_args.bindings.iter() {
if type_binding.ident.name == rustc_span::sym::Output {
if let hir::TypeBindingKind::Equality {
term: hir::Term::Ty(ty),
} = type_binding.kind
{
return Some(ty);
}
}
}
}
}
}
_ => {}
}
}
}
None
}
pub(super) fn asyncness(&self, local_def_id: LocalDefId) -> Option<hir::IsAsync> {
// similar to the asyncness fn in rustc_ty_utils::ty
let hir_id = self.tcx().hir().local_def_id_to_hir_id(local_def_id);
let node = self.tcx().hir().get(hir_id);
let fn_kind = node.fn_kind()?;
Some(fn_kind.asyncness())
}
// Here, we check for the case where the anonymous region // Here, we check for the case where the anonymous region
// is in the return type as written by the user. // is in the return type as written by the user.
// FIXME(#42703) - Need to handle certain cases here. // FIXME(#42703) - Need to handle certain cases here.

View file

@ -2,14 +2,12 @@ error[E0623]: lifetime mismatch
--> $DIR/issue-63388-1.rs:14:9 --> $DIR/issue-63388-1.rs:14:9
| |
LL | &'a self, foo: &dyn Foo LL | &'a self, foo: &dyn Foo
| -------- this parameter and the returned future are declared with different lifetimes... | -------- this parameter and the return type are declared with different lifetimes...
LL | ) -> &dyn Foo LL | ) -> &dyn Foo
| -------- | --------
| |
| this `async fn` implicitly returns an `impl Future<Output = &dyn Foo>`
LL | { LL | {
LL | foo LL | foo
| ^^^ ...but data from `foo` is held across an await point here | ^^^ ...but data from `foo` is returned here
error: aborting due to previous error error: aborting due to previous error

View file

@ -4,9 +4,8 @@ error[E0623]: lifetime mismatch
LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b { LL | async fn async_ret_impl_trait3<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> + 'b {
| ------ ^^^^^^^^^^^^^^^^^^^ | ------ ^^^^^^^^^^^^^^^^^^^
| | | | | |
| | ...but data from `a` is held across an await point here | | ...but data from `a` is returned here
| | this `async fn` implicitly returns an `impl Future<Output = impl Trait<'a> + 'b>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ret-impl-trait-one.rs:16:65 --> $DIR/ret-impl-trait-one.rs:16:65

View file

@ -2,28 +2,25 @@ error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
| |
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f } LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ---- ---- ^ ...but data from `f` is held across an await point here | ---- ---- ^ ...but data from `f` is returned here
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &Foo>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:82 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:11:82
| |
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) } LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ---- ----------------- ^ ...but data from `f` is held across an await point here | ---- ----------------- ^ ...but data from `f` is returned here
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = (Pin<&Foo>, &Foo)>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64 --> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
| |
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg } LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| ------ --- ^^^ ...but data from `arg` is held across an await point here | ------ --- ^^^ ...but data from `arg` is returned here
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &()>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
error: aborting due to 3 previous errors error: aborting due to 3 previous errors

View file

@ -3,66 +3,60 @@ error[E0623]: lifetime mismatch
| |
LL | async fn ref_self(&self, f: &u32) -> &u32 { LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:19:9 --> $DIR/lt-ref-self-async.rs:19:9
| |
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:23:9 --> $DIR/lt-ref-self-async.rs:23:9
| |
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:27:9 --> $DIR/lt-ref-self-async.rs:27:9
| |
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:31:9 --> $DIR/lt-ref-self-async.rs:31:9
| |
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:35:9 --> $DIR/lt-ref-self-async.rs:35:9
| |
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -3,66 +3,60 @@ error[E0623]: lifetime mismatch
| |
LL | async fn ref_self(&mut self, f: &u32) -> &u32 { LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:19:9 --> $DIR/ref-mut-self-async.rs:19:9
| |
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 { LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:23:9 --> $DIR/ref-mut-self-async.rs:23:9
| |
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 { LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:27:9 --> $DIR/ref-mut-self-async.rs:27:9
| |
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 { LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:31:9 --> $DIR/ref-mut-self-async.rs:31:9
| |
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:35:9 --> $DIR/ref-mut-self-async.rs:35:9
| |
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 { LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error: aborting due to 6 previous errors error: aborting due to 6 previous errors

View file

@ -3,55 +3,50 @@ error[E0623]: lifetime mismatch
| |
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 { LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:17:9 --> $DIR/ref-mut-struct-async.rs:17:9
| |
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 { LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:21:9 --> $DIR/ref-mut-struct-async.rs:21:9
| |
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 { LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:25:9 --> $DIR/ref-mut-struct-async.rs:25:9
| |
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:29:9 --> $DIR/ref-mut-struct-async.rs:29:9
| |
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 { LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error: aborting due to 5 previous errors error: aborting due to 5 previous errors

View file

@ -3,77 +3,70 @@ error[E0623]: lifetime mismatch
| |
LL | async fn ref_self(&self, f: &u32) -> &u32 { LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:29:9 --> $DIR/ref-self-async.rs:29:9
| |
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 { LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:33:9 --> $DIR/ref-self-async.rs:33:9
| |
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 { LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:37:9 --> $DIR/ref-self-async.rs:37:9
| |
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 { LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:41:9 --> $DIR/ref-self-async.rs:41:9
| |
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:45:9 --> $DIR/ref-self-async.rs:45:9
| |
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 { LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:49:9 --> $DIR/ref-self-async.rs:49:9
| |
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 { LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| --- --- | --- ---
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u8>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error: aborting due to 7 previous errors error: aborting due to 7 previous errors

View file

@ -3,55 +3,50 @@ error[E0623]: lifetime mismatch
| |
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 { LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:17:9 --> $DIR/ref-struct-async.rs:17:9
| |
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 { LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:21:9 --> $DIR/ref-struct-async.rs:21:9
| |
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 { LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:25:9 --> $DIR/ref-struct-async.rs:25:9
| |
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 { LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error[E0623]: lifetime mismatch error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:29:9 --> $DIR/ref-struct-async.rs:29:9
| |
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 { LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ---- ---- | ---- ----
| | | | |
| | this `async fn` implicitly returns an `impl Future<Output = &u32>` | this parameter and the return type are declared with different lifetimes...
| this parameter and the returned future are declared with different lifetimes...
LL | f LL | f
| ^ ...but data from `f` is held across an await point here | ^ ...but data from `f` is returned here
error: aborting due to 5 previous errors error: aborting due to 5 previous errors