NiceRegionError: Use written return type for async fn
This commit is contained in:
parent
6487845884
commit
5c15ad7fca
13 changed files with 181 additions and 165 deletions
|
@ -2726,6 +2726,10 @@ pub struct FnHeader {
|
|||
}
|
||||
|
||||
impl FnHeader {
|
||||
pub fn is_async(&self) -> bool {
|
||||
matches!(&self.asyncness, IsAsync::Async)
|
||||
}
|
||||
|
||||
pub fn is_const(&self) -> bool {
|
||||
matches!(&self.constness, Constness::Const)
|
||||
}
|
||||
|
@ -3169,7 +3173,7 @@ impl<'hir> Node<'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn fn_decl(&self) -> Option<&FnDecl<'hir>> {
|
||||
pub fn fn_decl(&self) -> Option<&'hir FnDecl<'hir>> {
|
||||
match self {
|
||||
Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
|
||||
| Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
|
||||
|
@ -3181,6 +3185,15 @@ impl<'hir> Node<'hir> {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn fn_sig(&self) -> Option<&'hir FnSig<'hir>> {
|
||||
match self {
|
||||
Node::TraitItem(TraitItem { kind: TraitItemKind::Fn(fn_sig, _), .. })
|
||||
| Node::ImplItem(ImplItem { kind: ImplItemKind::Fn(fn_sig, _), .. })
|
||||
| Node::Item(Item { kind: ItemKind::Fn(fn_sig, _, _), .. }) => Some(fn_sig),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
|
||||
pub fn body_id(&self) -> Option<BodyId> {
|
||||
match self {
|
||||
Node::TraitItem(TraitItem {
|
||||
|
|
|
@ -65,9 +65,9 @@ use rustc_hir::def_id::DefId;
|
|||
use rustc_hir::lang_items::LangItem;
|
||||
use rustc_hir::{Item, ItemKind, Node};
|
||||
use rustc_middle::dep_graph::DepContext;
|
||||
use rustc_middle::ty::error::TypeError;
|
||||
use rustc_middle::ty::{
|
||||
self,
|
||||
error::TypeError,
|
||||
subst::{GenericArgKind, Subst, SubstsRef},
|
||||
Binder, Region, Ty, TyCtxt, TypeFoldable,
|
||||
};
|
||||
|
|
|
@ -171,6 +171,7 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
|||
|
||||
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()
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
use rustc_hir as hir;
|
||||
use rustc_hir::intravisit::{self, Visitor};
|
||||
use rustc_hir::Node;
|
||||
use rustc_middle::hir::map::Map;
|
||||
use rustc_middle::hir::nested_filter;
|
||||
use rustc_middle::middle::resolve_lifetime as rl;
|
||||
|
@ -25,25 +24,19 @@ pub(crate) fn find_anon_type<'tcx>(
|
|||
tcx: TyCtxt<'tcx>,
|
||||
region: Region<'tcx>,
|
||||
br: &ty::BoundRegionKind,
|
||||
) -> Option<(&'tcx hir::Ty<'tcx>, &'tcx hir::FnDecl<'tcx>)> {
|
||||
) -> Option<(&'tcx hir::Ty<'tcx>, &'tcx hir::FnSig<'tcx>)> {
|
||||
if let Some(anon_reg) = tcx.is_suitable_region(region) {
|
||||
let hir_id = tcx.hir().local_def_id_to_hir_id(anon_reg.def_id);
|
||||
let fndecl = match tcx.hir().get(hir_id) {
|
||||
Node::Item(&hir::Item { kind: hir::ItemKind::Fn(ref m, ..), .. })
|
||||
| Node::TraitItem(&hir::TraitItem {
|
||||
kind: hir::TraitItemKind::Fn(ref m, ..), ..
|
||||
})
|
||||
| Node::ImplItem(&hir::ImplItem { kind: hir::ImplItemKind::Fn(ref m, ..), .. }) => {
|
||||
&m.decl
|
||||
}
|
||||
_ => return None,
|
||||
let Some(fn_sig) = tcx.hir().get(hir_id).fn_sig() else {
|
||||
return None
|
||||
};
|
||||
|
||||
fndecl
|
||||
fn_sig
|
||||
.decl
|
||||
.inputs
|
||||
.iter()
|
||||
.find_map(|arg| find_component_for_bound_region(tcx, arg, br))
|
||||
.map(|ty| (ty, &**fndecl))
|
||||
.map(|ty| (ty, fn_sig))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
use crate::infer::error_reporting::nice_region_error::NiceRegionError;
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def_id::LocalDefId;
|
||||
use rustc_middle::ty::{self, DefIdTree, Region, Ty};
|
||||
use rustc_middle::ty::{self, Binder, DefIdTree, Region, Ty, TypeFoldable};
|
||||
use rustc_span::Span;
|
||||
|
||||
/// Information about the anonymous region we are searching for.
|
||||
|
@ -149,26 +149,41 @@ impl<'a, 'tcx> NiceRegionError<'a, 'tcx> {
|
|||
}
|
||||
|
||||
// Here, we check for the case where the anonymous region
|
||||
// is in the return type.
|
||||
// is in the return type as written by the user.
|
||||
// FIXME(#42703) - Need to handle certain cases here.
|
||||
pub(super) fn is_return_type_anon(
|
||||
&self,
|
||||
scope_def_id: LocalDefId,
|
||||
br: ty::BoundRegionKind,
|
||||
decl: &hir::FnDecl<'_>,
|
||||
hir_sig: &hir::FnSig<'_>,
|
||||
) -> Option<Span> {
|
||||
let ret_ty = self.tcx().type_of(scope_def_id);
|
||||
if let ty::FnDef(_, _) = ret_ty.kind() {
|
||||
let sig = ret_ty.fn_sig(self.tcx());
|
||||
let late_bound_regions =
|
||||
self.tcx().collect_referenced_late_bound_regions(&sig.output());
|
||||
if late_bound_regions.iter().any(|r| *r == br) {
|
||||
return Some(decl.output.span());
|
||||
}
|
||||
let fn_ty = self.tcx().type_of(scope_def_id);
|
||||
if let ty::FnDef(_, _) = fn_ty.kind() {
|
||||
let ret_ty = fn_ty.fn_sig(self.tcx()).output();
|
||||
let span = hir_sig.decl.output.span();
|
||||
let future_output = if hir_sig.header.is_async() {
|
||||
ret_ty.map_bound(|ty| self.infcx.get_impl_future_output_ty(ty)).transpose()
|
||||
} else {
|
||||
None
|
||||
};
|
||||
return match future_output {
|
||||
Some(output) if self.includes_region(output, br) => Some(span),
|
||||
None if self.includes_region(ret_ty, br) => Some(span),
|
||||
_ => None,
|
||||
};
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
fn includes_region(
|
||||
&self,
|
||||
ty: Binder<'tcx, impl TypeFoldable<'tcx>>,
|
||||
region: ty::BoundRegionKind,
|
||||
) -> bool {
|
||||
let late_bound_regions = self.tcx().collect_referenced_late_bound_regions(&ty);
|
||||
late_bound_regions.iter().any(|r| *r == region)
|
||||
}
|
||||
|
||||
// Here we check for the case where anonymous region
|
||||
// corresponds to self and if yes, we display E0312.
|
||||
// FIXME(#42700) - Need to format self properly to
|
||||
|
|
|
@ -2,23 +2,17 @@ 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...
|
||||
| ---------------- these two types are declared with different lifetimes...
|
||||
LL | ListFut(bufs).await
|
||||
| ^^^^ ...but data from `bufs` is held across an await point here
|
||||
| ^^^^ ...but data from `bufs` flows into `bufs` 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...
|
||||
| ---------------- these two types are declared with different lifetimes...
|
||||
LL | ListFut2(bufs).await
|
||||
| ^^^^ ...but data from `bufs` is held across an await point here
|
||||
| ^^^^ ...but data from `bufs` flows into `bufs` here
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/issue-63388-1.rs:14:9
|
||||
|
|
||||
LL | &'a self, foo: &dyn Foo
|
||||
| -------- this parameter and the returned future are declared with different lifetimes...
|
||||
| -------- this parameter and the returned future are declared with different lifetimes...
|
||||
LL | ) -> &dyn Foo
|
||||
| --------
|
||||
| |
|
||||
|
|
|
@ -2,28 +2,28 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:8:52
|
||||
|
|
||||
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
|
||||
| ---- ---- ^ ...but data from `f` is held across an await point here
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = &Foo>`
|
||||
| this parameter and the returned future are declared with different lifetimes...
|
||||
| ---- ---- ^ ...but data from `f` is held across an await point here
|
||||
| | |
|
||||
| | 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
|
||||
--> $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) }
|
||||
| ----- ----------------- ^ ...but data from `f` is held across an await point here
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = (Pin<&Foo>, &Foo)>`
|
||||
| this parameter and the returned future are declared with different lifetimes...
|
||||
| ---- ----------------- ^ ...but data from `f` is held across an await point here
|
||||
| | |
|
||||
| | 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
|
||||
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:17:64
|
||||
|
|
||||
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
|
||||
| ----- --- ^^^ ...but data from `arg` is held across an await point here
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = &()>`
|
||||
| this parameter and the returned future are declared with different lifetimes...
|
||||
| ------ --- ^^^ ...but data from `arg` is held across an await point here
|
||||
| | |
|
||||
| | 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
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/lt-ref-self-async.rs:13:9
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ----- ----
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||
| this parameter and the returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -13,10 +13,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/lt-ref-self-async.rs:19:9
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ----- ----
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||
| this parameter and the returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -24,10 +24,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/lt-ref-self-async.rs:23:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -35,10 +35,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/lt-ref-self-async.rs:27:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -46,10 +46,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/lt-ref-self-async.rs:31:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -57,10 +57,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/lt-ref-self-async.rs:35:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-self-async.rs:13:9
|
||||
|
|
||||
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
|
||||
| --------- ----
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||
| this parameter and the returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -13,10 +13,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-self-async.rs:19:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -24,10 +24,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-self-async.rs:23:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -35,10 +35,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-self-async.rs:27:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -46,10 +46,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-self-async.rs:31:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -57,10 +57,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-self-async.rs:35:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-struct-async.rs:13:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -13,10 +13,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-struct-async.rs:17:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -24,10 +24,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-struct-async.rs:21:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -35,10 +35,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-struct-async.rs:25:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -46,10 +46,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-mut-struct-async.rs:29:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-self-async.rs:23:9
|
||||
|
|
||||
LL | async fn ref_self(&self, f: &u32) -> &u32 {
|
||||
| ----- ----
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||
| this parameter and the returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -13,10 +13,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-self-async.rs:29:9
|
||||
|
|
||||
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
|
||||
| ----- ----
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||
| this parameter and the returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -24,10 +24,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-self-async.rs:33:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -35,10 +35,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-self-async.rs:37:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -46,10 +46,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-self-async.rs:41:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -57,10 +57,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-self-async.rs:45:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -68,10 +68,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-self-async.rs:49:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-struct-async.rs:13:9
|
||||
|
|
||||
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
|
||||
| ------- ----
|
||||
| | |
|
||||
| | this `async fn` implicitly returns an `impl Future<Output = &u32>`
|
||||
| this parameter and the returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -13,10 +13,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-struct-async.rs:17:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -24,10 +24,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-struct-async.rs:21:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -35,10 +35,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-struct-async.rs:25:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
@ -46,10 +46,10 @@ error[E0623]: lifetime mismatch
|
|||
--> $DIR/ref-struct-async.rs:29:9
|
||||
|
|
||||
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 returned future 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
|
||||
| ^ ...but data from `f` is held across an await point here
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue