mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 15:01:51 +00:00
Rollup merge of #76765 - guswynn:async_return, r=tmandry
Make it more clear what an about async fn's returns when referring to what it returns see #76547 This is *likely* not the ONLY place that this happens to be unclear, but we can move this fn to rustc_middle or something like that and reuse it if need be, to apply it to more diagnostics One outstanding question I have is, if the fn returns (), should I make the message more clear (what about `fn f()` vs `fn f() -> ()`, can you tell those apart in the hir?) R? `@tmandry` `@rustbot` modify labels +A-diagnostics +T-compiler
This commit is contained in:
commit
9596e34ad4
@ -102,43 +102,89 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
|||||||
None => String::new(),
|
None => String::new(),
|
||||||
};
|
};
|
||||||
|
|
||||||
let (span_1, span_2, main_label, span_label) = match (sup_is_ret_type, sub_is_ret_type) {
|
let (span_1, span_2, main_label, span_label, future_return_type) =
|
||||||
(None, None) => {
|
match (sup_is_ret_type, sub_is_ret_type) {
|
||||||
let (main_label_1, span_label_1) = if ty_sup.hir_id == ty_sub.hir_id {
|
(None, None) => {
|
||||||
(
|
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(),
|
"this type is declared with multiple lifetimes...".to_owned(),
|
||||||
)
|
"...but data with one lifetime flows into the other here".to_owned(),
|
||||||
} else {
|
)
|
||||||
(
|
} else {
|
||||||
"these two types are declared with different lifetimes...".to_owned(),
|
(
|
||||||
format!("...but data{} flows{} here", span_label_var1, span_label_var2),
|
"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)
|
};
|
||||||
}
|
(ty_sup.span, ty_sub.span, main_label_1, span_label_1, None)
|
||||||
|
}
|
||||||
|
|
||||||
(Some(ret_span), _) => (
|
(Some(ret_span), _) => {
|
||||||
ty_sub.span,
|
let sup_future = self.future_return_type(scope_def_id_sup);
|
||||||
ret_span,
|
let (return_type, action) = if let Some(_) = sup_future {
|
||||||
"this parameter and the return type are declared with different lifetimes..."
|
("returned future", "held across an await point")
|
||||||
.to_owned(),
|
} else {
|
||||||
format!("...but data{} is returned here", span_label_var1),
|
("return type", "returned")
|
||||||
),
|
};
|
||||||
(_, Some(ret_span)) => (
|
|
||||||
ty_sup.span,
|
|
||||||
ret_span,
|
|
||||||
"this parameter and the return type are declared with different lifetimes..."
|
|
||||||
.to_owned(),
|
|
||||||
format!("...but data{} is returned here", span_label_var1),
|
|
||||||
),
|
|
||||||
};
|
|
||||||
|
|
||||||
struct_span_err!(self.tcx().sess, span, E0623, "lifetime mismatch")
|
(
|
||||||
.span_label(span_1, main_label)
|
ty_sub.span,
|
||||||
.span_label(span_2, String::new())
|
ret_span,
|
||||||
.span_label(span, span_label)
|
format!(
|
||||||
.emit();
|
"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 let Some(_) = sub_future {
|
||||||
|
("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 e = struct_span_err!(self.tcx().sess, span, E0623, "lifetime mismatch");
|
||||||
|
|
||||||
|
e.span_label(span_1, main_label);
|
||||||
|
e.span_label(span_2, String::new());
|
||||||
|
e.span_label(span, span_label);
|
||||||
|
|
||||||
|
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("{unnamed_type}".to_string());
|
||||||
|
|
||||||
|
e.span_label(
|
||||||
|
t.span,
|
||||||
|
&format!("this `async fn` implicitly returns an `impl Future<Output = {}>`", snip),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
e.emit();
|
||||||
Some(ErrorReported)
|
Some(ErrorReported)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -85,6 +85,60 @@ 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 { 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::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_like = rustc_middle::hir::map::blocks::FnLikeNode::from_node(node)?;
|
||||||
|
|
||||||
|
Some(fn_like.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.
|
// is in the return type.
|
||||||
// FIXME(#42703) - Need to handle certain cases here.
|
// FIXME(#42703) - Need to handle certain cases here.
|
||||||
|
@ -2,12 +2,14 @@ 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 return type are declared with different lifetimes...
|
| -------- this parameter and the returned future 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 returned here
|
| ^^^ ...but data from `foo` is held across an await point here
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -4,8 +4,9 @@ error[E0623]: lifetime mismatch
|
|||||||
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
LL | async fn async_ret_impl_trait1<'a, 'b>(a: &'a u8, b: &'b u8) -> impl Trait<'a> {
|
||||||
| ------ ^^^^^^^^^^^^^^
|
| ------ ^^^^^^^^^^^^^^
|
||||||
| | |
|
| | |
|
||||||
| | ...but data from `b` is returned here
|
| | ...but data from `b` is held across an await point here
|
||||||
| this parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = impl Trait<'a>>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
20
src/test/ui/issues/issue-76547.nll.stderr
Normal file
20
src/test/ui/issues/issue-76547.nll.stderr
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
error: lifetime may not live long enough
|
||||||
|
--> $DIR/issue-76547.rs:19:14
|
||||||
|
|
|
||||||
|
LL | async fn fut(bufs: &mut [&mut [u8]]) {
|
||||||
|
| ^^^^ - - let's call the lifetime of this reference `'2`
|
||||||
|
| | |
|
||||||
|
| | let's call the lifetime of this reference `'1`
|
||||||
|
| assignment requires that `'1` must outlive `'2`
|
||||||
|
|
||||||
|
error: lifetime may not live long enough
|
||||||
|
--> $DIR/issue-76547.rs:33:15
|
||||||
|
|
|
||||||
|
LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
|
||||||
|
| ^^^^ - - let's call the lifetime of this reference `'2`
|
||||||
|
| | |
|
||||||
|
| | let's call the lifetime of this reference `'1`
|
||||||
|
| assignment requires that `'1` must outlive `'2`
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
38
src/test/ui/issues/issue-76547.rs
Normal file
38
src/test/ui/issues/issue-76547.rs
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
// Test for diagnostic improvement issue #76547
|
||||||
|
// edition:2018
|
||||||
|
|
||||||
|
use std::{
|
||||||
|
future::Future,
|
||||||
|
task::{Context, Poll}
|
||||||
|
};
|
||||||
|
use std::pin::Pin;
|
||||||
|
|
||||||
|
pub struct ListFut<'a>(&'a mut [&'a mut [u8]]);
|
||||||
|
impl<'a> Future for ListFut<'a> {
|
||||||
|
type Output = ();
|
||||||
|
|
||||||
|
fn poll(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn fut(bufs: &mut [&mut [u8]]) {
|
||||||
|
ListFut(bufs).await
|
||||||
|
//~^ ERROR lifetime mismatch
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct ListFut2<'a>(&'a mut [&'a mut [u8]]);
|
||||||
|
impl<'a> Future for ListFut2<'a> {
|
||||||
|
type Output = i32;
|
||||||
|
|
||||||
|
fn poll(self: Pin<&mut Self>, _cx: &mut Context) -> Poll<Self::Output> {
|
||||||
|
unimplemented!()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
|
||||||
|
ListFut2(bufs).await
|
||||||
|
//~^ ERROR lifetime mismatch
|
||||||
|
}
|
||||||
|
|
||||||
|
fn main() {}
|
25
src/test/ui/issues/issue-76547.stderr
Normal file
25
src/test/ui/issues/issue-76547.stderr
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
error[E0623]: lifetime mismatch
|
||||||
|
--> $DIR/issue-76547.rs:20:13
|
||||||
|
|
|
||||||
|
LL | async fn fut(bufs: &mut [&mut [u8]]) {
|
||||||
|
| --------- -
|
||||||
|
| | |
|
||||||
|
| | this `async fn` implicitly returns an `impl Future<Output = ()>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
|
LL | ListFut(bufs).await
|
||||||
|
| ^^^^ ...but data from `bufs` is held across an await point here
|
||||||
|
|
||||||
|
error[E0623]: lifetime mismatch
|
||||||
|
--> $DIR/issue-76547.rs:34:14
|
||||||
|
|
|
||||||
|
LL | async fn fut2(bufs: &mut [&mut [u8]]) -> i32 {
|
||||||
|
| --------- ---
|
||||||
|
| | |
|
||||||
|
| | this `async fn` implicitly returns an `impl Future<Output = i32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
|
LL | ListFut2(bufs).await
|
||||||
|
| ^^^^ ...but data from `bufs` is held across an await point here
|
||||||
|
|
||||||
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0623`.
|
@ -2,25 +2,28 @@ 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 returned here
|
| ---- ---- ^ ...but data from `f` is held across an await point here
|
||||||
| |
|
| | |
|
||||||
| this parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &Foo>`
|
||||||
|
| 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 returned here
|
| ----- ----------------- ^ ...but data from `f` is held across an await point here
|
||||||
| |
|
| | |
|
||||||
| this parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = (Pin<&Foo>, &Foo)>`
|
||||||
|
| 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 returned here
|
| ----- --- ^^^ ...but data from `arg` is held across an await point here
|
||||||
| |
|
| | |
|
||||||
| this parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &()>`
|
||||||
|
| 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
|
||||||
|
|
||||||
|
@ -3,60 +3,66 @@ error[E0623]: lifetime mismatch
|
|||||||
|
|
|
|
||||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||||
| ----- ----
|
| ----- ----
|
||||||
| |
|
| | |
|
||||||
| this parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point here
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
@ -3,60 +3,66 @@ 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point here
|
||||||
|
|
||||||
error: aborting due to 6 previous errors
|
error: aborting due to 6 previous errors
|
||||||
|
|
||||||
|
@ -3,50 +3,55 @@ 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point here
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
@ -3,70 +3,77 @@ error[E0623]: lifetime mismatch
|
|||||||
|
|
|
|
||||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||||
| ----- ----
|
| ----- ----
|
||||||
| |
|
| | |
|
||||||
| this parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u8>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point here
|
||||||
|
|
||||||
error: aborting due to 7 previous errors
|
error: aborting due to 7 previous errors
|
||||||
|
|
||||||
|
@ -3,50 +3,55 @@ 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point 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 parameter and the return type are declared with different lifetimes...
|
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||||
|
| this parameter and the returned future are declared with different lifetimes...
|
||||||
LL | f
|
LL | f
|
||||||
| ^ ...but data from `f` is returned here
|
| ^ ...but data from `f` is held across an await point here
|
||||||
|
|
||||||
error: aborting due to 5 previous errors
|
error: aborting due to 5 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user