Rollup merge of #63499 - nikomatsakis:issuee-63388-async-fn-elision-self-mut-self, r=cramertj

handle elision in async fn correctly

We now always make fresh lifetimne parameters for all elided
lifetimes, whether they are in the inputs or outputs. But then
we generate `'_` in the case of elided lifetimes from the outputs.

Example:

```rust
async fn foo<'a>(x: &'a u32) -> &u32 { .. }
```

becomes

```rust
type Foo<'a, 'b> = impl Future<Output = &'b u32>;
fn foo<'a>(x: &'a u32) -> Foo<'a, '_>
```

Fixes #63388
This commit is contained in:
Mazdak Farrokhzad 2019-08-14 04:18:48 +02:00 committed by GitHub
commit 4134241bcf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
43 changed files with 992 additions and 1917 deletions

View File

@ -337,49 +337,6 @@ enum AnonymousLifetimeMode {
/// Pass responsibility to `resolve_lifetime` code for all cases.
PassThrough,
/// Used in the return types of `async fn` where there exists
/// exactly one argument-position elided lifetime.
///
/// In `async fn`, we lower the arguments types using the `CreateParameter`
/// mode, meaning that non-`dyn` elided lifetimes are assigned a fresh name.
/// If any corresponding elided lifetimes appear in the output, we need to
/// replace them with references to the fresh name assigned to the corresponding
/// elided lifetime in the arguments.
///
/// For **Modern cases**, replace the anonymous parameter with a
/// reference to a specific freshly-named lifetime that was
/// introduced in argument
///
/// For **Dyn Bound** cases, pass responsibility to
/// `resole_lifetime` code.
Replace(LtReplacement),
}
/// The type of elided lifetime replacement to perform on `async fn` return types.
#[derive(Copy, Clone)]
enum LtReplacement {
/// Fresh name introduced by the single non-dyn elided lifetime
/// in the arguments of the async fn.
Some(ParamName),
/// There is no single non-dyn elided lifetime because no lifetimes
/// appeared in the arguments.
NoLifetimes,
/// There is no single non-dyn elided lifetime because multiple
/// lifetimes appeared in the arguments.
MultipleLifetimes,
}
/// Calculates the `LtReplacement` to use for elided lifetimes in the return
/// type based on the fresh elided lifetimes introduced in argument position.
fn get_elided_lt_replacement(arg_position_lifetimes: &[(Span, ParamName)]) -> LtReplacement {
match arg_position_lifetimes {
[] => LtReplacement::NoLifetimes,
[(_span, param)] => LtReplacement::Some(*param),
_ => LtReplacement::MultipleLifetimes,
}
}
struct ImplTraitTypeIdVisitor<'a> { ids: &'a mut SmallVec<[NodeId; 1]> }
@ -1953,8 +1910,7 @@ impl<'a> LoweringContext<'a> {
err.emit();
}
AnonymousLifetimeMode::PassThrough |
AnonymousLifetimeMode::ReportError |
AnonymousLifetimeMode::Replace(_) => {
AnonymousLifetimeMode::ReportError => {
self.sess.buffer_lint_with_diagnostic(
ELIDED_LIFETIMES_IN_PATHS,
CRATE_NODE_ID,
@ -2141,7 +2097,6 @@ impl<'a> LoweringContext<'a> {
// Remember how many lifetimes were already around so that we can
// only look at the lifetime parameters introduced by the arguments.
let lifetime_count_before_args = self.lifetimes_to_define.len();
let inputs = self.with_anonymous_lifetime_mode(lt_mode, |this| {
decl.inputs
.iter()
@ -2156,16 +2111,10 @@ impl<'a> LoweringContext<'a> {
});
let output = if let Some(ret_id) = make_ret_async {
// Calculate the `LtReplacement` to use for any return-position elided
// lifetimes based on the elided lifetime parameters introduced in the args.
let lt_replacement = get_elided_lt_replacement(
&self.lifetimes_to_define[lifetime_count_before_args..]
);
self.lower_async_fn_ret_ty(
&decl.output,
in_band_ty_params.expect("`make_ret_async` but no `fn_def_id`").0,
ret_id,
lt_replacement,
)
} else {
match decl.output {
@ -2230,7 +2179,6 @@ impl<'a> LoweringContext<'a> {
output: &FunctionRetTy,
fn_def_id: DefId,
opaque_ty_node_id: NodeId,
elided_lt_replacement: LtReplacement,
) -> hir::FunctionRetTy {
let span = output.span();
@ -2248,9 +2196,65 @@ impl<'a> LoweringContext<'a> {
self.allocate_hir_id_counter(opaque_ty_node_id);
// When we create the opaque type for this async fn, it is going to have
// to capture all the lifetimes involved in the signature (including in the
// return type). This is done by introducing lifetime parameters for:
//
// - all the explicitly declared lifetimes from the impl and function itself;
// - all the elided lifetimes in the fn arguments;
// - all the elided lifetimes in the return type.
//
// So for example in this snippet:
//
// ```rust
// impl<'a> Foo<'a> {
// async fn bar<'b>(&self, x: &'b Vec<f64>, y: &str) -> &u32 {
// // ^ '0 ^ '1 ^ '2
// // elided lifetimes used below
// }
// }
// ```
//
// we would create an opaque type like:
//
// ```
// type Bar<'a, 'b, '0, '1, '2> = impl Future<Output = &'2 u32>;
// ```
//
// and we would then desugar `bar` to the equivalent of:
//
// ```rust
// impl<'a> Foo<'a> {
// fn bar<'b, '0, '1>(&'0 self, x: &'b Vec<f64>, y: &'1 str) -> Bar<'a, 'b, '0, '1, '_>
// }
// ```
//
// Note that the final parameter to `Bar` is `'_`, not `'2` --
// this is because the elided lifetimes from the return type
// should be figured out using the ordinary elision rules, and
// this desugaring achieves that.
//
// The variable `input_lifetimes_count` tracks the number of
// lifetime parameters to the opaque type *not counting* those
// lifetimes elided in the return type. This includes those
// that are explicitly declared (`in_scope_lifetimes`) and
// those elided lifetimes we found in the arguments (current
// content of `lifetimes_to_define`). Next, we will process
// the return type, which will cause `lifetimes_to_define` to
// grow.
let input_lifetimes_count = self.in_scope_lifetimes.len() + self.lifetimes_to_define.len();
let (opaque_ty_id, lifetime_params) = self.with_hir_id_owner(opaque_ty_node_id, |this| {
// We have to be careful to get elision right here. The
// idea is that we create a lifetime parameter for each
// lifetime in the return type. So, given a return type
// like `async fn foo(..) -> &[&u32]`, we lower to `impl
// Future<Output = &'1 [ &'2 u32 ]>`.
//
// Then, we will create `fn foo(..) -> Foo<'_, '_>`, and
// hence the elision takes place at the fn site.
let future_bound = this.with_anonymous_lifetime_mode(
AnonymousLifetimeMode::Replace(elided_lt_replacement),
AnonymousLifetimeMode::CreateParameter,
|this| this.lower_async_fn_output_type_to_future_bound(
output,
fn_def_id,
@ -2304,19 +2308,52 @@ impl<'a> LoweringContext<'a> {
(opaque_ty_id, lifetime_params)
});
let generic_args =
lifetime_params
.iter().cloned()
.map(|(span, hir_name)| {
GenericArg::Lifetime(hir::Lifetime {
hir_id: self.next_id(),
span,
name: hir::LifetimeName::Param(hir_name),
})
// As documented above on the variable
// `input_lifetimes_count`, we need to create the lifetime
// arguments to our opaque type. Continuing with our example,
// we're creating the type arguments for the return type:
//
// ```
// Bar<'a, 'b, '0, '1, '_>
// ```
//
// For the "input" lifetime parameters, we wish to create
// references to the parameters themselves, including the
// "implicit" ones created from parameter types (`'a`, `'b`,
// '`0`, `'1`).
//
// For the "output" lifetime parameters, we just want to
// generate `'_`.
let mut generic_args: Vec<_> =
lifetime_params[..input_lifetimes_count]
.iter()
.map(|&(span, hir_name)| {
// Input lifetime like `'a` or `'1`:
GenericArg::Lifetime(hir::Lifetime {
hir_id: self.next_id(),
span,
name: hir::LifetimeName::Param(hir_name),
})
.collect();
})
.collect();
generic_args.extend(
lifetime_params[input_lifetimes_count..]
.iter()
.map(|&(span, _)| {
// Output lifetime like `'_`.
GenericArg::Lifetime(hir::Lifetime {
hir_id: self.next_id(),
span,
name: hir::LifetimeName::Implicit,
})
})
);
let opaque_ty_ref = hir::TyKind::Def(hir::ItemId { id: opaque_ty_id }, generic_args);
// Create the `Foo<...>` refernece itself. Note that the `type
// Foo = impl Trait` is, internally, created as a child of the
// async fn, so the *type parameters* are inherited. It's
// only the lifetime parameters that we must supply.
let opaque_ty_ref = hir::TyKind::Def(hir::ItemId { id: opaque_ty_id }, generic_args.into());
hir::FunctionRetTy::Return(P(hir::Ty {
node: opaque_ty_ref,
@ -2412,11 +2449,6 @@ impl<'a> LoweringContext<'a> {
}
AnonymousLifetimeMode::ReportError => self.new_error_lifetime(Some(l.id), span),
AnonymousLifetimeMode::Replace(replacement) => {
let hir_id = self.lower_node_id(l.id);
self.replace_elided_lifetime(hir_id, span, replacement)
}
},
ident => {
self.maybe_collect_in_band_lifetime(ident);
@ -2439,39 +2471,6 @@ impl<'a> LoweringContext<'a> {
}
}
/// Replace a return-position elided lifetime with the elided lifetime
/// from the arguments.
fn replace_elided_lifetime(
&mut self,
hir_id: hir::HirId,
span: Span,
replacement: LtReplacement,
) -> hir::Lifetime {
let multiple_or_none = match replacement {
LtReplacement::Some(name) => {
return hir::Lifetime {
hir_id,
span,
name: hir::LifetimeName::Param(name),
};
}
LtReplacement::MultipleLifetimes => "multiple",
LtReplacement::NoLifetimes => "none",
};
let mut err = crate::middle::resolve_lifetime::report_missing_lifetime_specifiers(
self.sess,
span,
1,
);
err.note(&format!(
"return-position elided lifetimes require exactly one \
input-position elided lifetime, found {}.", multiple_or_none));
err.emit();
hir::Lifetime { hir_id, span, name: hir::LifetimeName::Error }
}
fn lower_generic_params(
&mut self,
params: &[GenericParam],
@ -3174,10 +3173,6 @@ impl<'a> LoweringContext<'a> {
AnonymousLifetimeMode::ReportError => self.new_error_lifetime(None, span),
AnonymousLifetimeMode::PassThrough => self.new_implicit_lifetime(span),
AnonymousLifetimeMode::Replace(replacement) => {
self.new_replacement_lifetime(replacement, span)
}
}
}
@ -3231,10 +3226,6 @@ impl<'a> LoweringContext<'a> {
// This is the normal case.
AnonymousLifetimeMode::PassThrough => self.new_implicit_lifetime(span),
AnonymousLifetimeMode::Replace(replacement) => {
self.new_replacement_lifetime(replacement, span)
}
AnonymousLifetimeMode::ReportError => self.new_error_lifetime(None, span),
}
}
@ -3266,25 +3257,11 @@ impl<'a> LoweringContext<'a> {
// This is the normal case.
AnonymousLifetimeMode::PassThrough => {}
// We don't need to do any replacement here as this lifetime
// doesn't refer to an elided lifetime elsewhere in the function
// signature.
AnonymousLifetimeMode::Replace(_) => {}
}
self.new_implicit_lifetime(span)
}
fn new_replacement_lifetime(
&mut self,
replacement: LtReplacement,
span: Span,
) -> hir::Lifetime {
let hir_id = self.next_id();
self.replace_elided_lifetime(hir_id, span, replacement)
}
fn new_implicit_lifetime(&mut self, span: Span) -> hir::Lifetime {
hir::Lifetime {
hir_id: self.next_id(),

View File

@ -0,0 +1,24 @@
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/issue-63388-1.rs:14:10
|
LL | ) -> &dyn Foo
| ^^^^^^^^
|
= note: hidden type `impl std::future::Future` captures lifetime '_#27r
error: lifetime may not live long enough
--> $DIR/issue-63388-1.rs:15:5
|
LL | async fn do_sth<'a>(
| -- lifetime `'a` defined here
LL | &'a self, foo: &dyn Foo
| - lifetime `'_` defined here
LL | ) -> &dyn Foo
LL | / {
LL | | foo
LL | | }
| |_____^ function was supposed to return data with lifetime `'a` but it is returning data with lifetime `'_`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0700`.

View File

@ -0,0 +1,20 @@
// edition:2018
#![feature(async_await)]
struct Xyz {
a: u64,
}
trait Foo {}
impl Xyz {
async fn do_sth<'a>(
&'a self, foo: &dyn Foo
) -> &dyn Foo //~ ERROR lifetime mismatch
{
foo
}
}
fn main() {}

View File

@ -0,0 +1,12 @@
error[E0623]: lifetime mismatch
--> $DIR/issue-63388-1.rs:14:10
|
LL | &'a self, foo: &dyn Foo
| -------- this parameter and the return type are declared with different lifetimes...
LL | ) -> &dyn Foo
| ^^^^^^^^
| |
| ...but data from `foo` is returned here
error: aborting due to previous error

View File

@ -0,0 +1,11 @@
error[E0106]: missing lifetime specifier
--> $DIR/issue-63388-2.rs:14:10
|
LL | ) -> &dyn Foo
| ^ help: consider using the named lifetime: `&'a`
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar`
error: aborting due to previous error
For more information about this error, try `rustc --explain E0106`.

View File

@ -0,0 +1,20 @@
// edition:2018
#![feature(async_await)]
struct Xyz {
a: u64,
}
trait Foo {}
impl Xyz {
async fn do_sth<'a>(
foo: &dyn Foo, bar: &'a dyn Foo //~ ERROR cannot infer
) -> &dyn Foo //~ ERROR missing lifetime specifier
{
foo
}
}
fn main() {}

View File

@ -0,0 +1,29 @@
error[E0106]: missing lifetime specifier
--> $DIR/issue-63388-2.rs:14:10
|
LL | ) -> &dyn Foo
| ^ help: consider using the named lifetime: `&'a`
|
= help: this function's return type contains a borrowed value, but the signature does not say whether it is borrowed from `foo` or `bar`
error: cannot infer an appropriate lifetime
--> $DIR/issue-63388-2.rs:13:9
|
LL | foo: &dyn Foo, bar: &'a dyn Foo
| ^^^ ...but this borrow...
LL | ) -> &dyn Foo
| -------- this return type evaluates to the `'static` lifetime...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 13:14
--> $DIR/issue-63388-2.rs:13:14
|
LL | foo: &dyn Foo, bar: &'a dyn Foo
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 13:14
|
LL | ) -> &dyn Foo + '_
| ^^^^^^^^^^^^^
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -0,0 +1,19 @@
// edition:2018
// check-pass
#![feature(async_await)]
struct Xyz {
a: u64,
}
trait Foo {}
impl Xyz {
async fn do_sth(
&self, foo: &dyn Foo
) {
}
}
fn main() {}

View File

@ -0,0 +1,12 @@
// check-pass
// edition:2018
#![feature(async_await)]
struct A;
impl A {
async fn foo(&self, f: &u32) -> &A { self }
}
fn main() { }

View File

@ -1,27 +1,46 @@
error[E0106]: missing lifetime specifier
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:45
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:60
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:50
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| - ^^^^^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:13:73
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| - ^^^^^^^^^^^^^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
| |
| lifetime `'_` defined here
| lifetime `'_` defined here
error[E0106]: missing lifetime specifier
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:67
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:19:58
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ^
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| ^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error: aborting due to 3 previous errors
error: lifetime may not live long enough
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:19:62
|
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| -- - ^^^^^^^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'a`
| | |
| | lifetime `'_` defined here
| lifetime `'a` defined here
For more information about this error, try `rustc --explain E0106`.
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0700`.

View File

@ -8,16 +8,10 @@ struct Foo;
impl Foo {
async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
// FIXME: should be E0623?
//~^ ERROR lifetime mismatch
async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
//~| ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
// FIXME: should be E0623?
//~^ ERROR lifetime mismatch
}
type Alias<T> = Pin<T>;

View File

@ -1,81 +1,23 @@
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:45
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:60
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:67
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: cannot infer an appropriate lifetime
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:33
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 10:26
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:10:26
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo { f }
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 10:26
|
LL | async fn a(self: Pin<&Foo>, f: &Foo) -> &Foo + '_ { f }
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:16
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ^^^^ ...but this borrow... ----------------- this return type evaluates to the `'static` lifetime...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 15:26
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:26
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 15:26
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) + '_ { (self, f) }
| ^^^^^^^^^^^^^^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:34
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ^ ----------------- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 15:26
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:15:26
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 15:26
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) + '_ { (self, f) }
| ^^^^^^^^^^^^^^^^^^^^^^
| ---- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:25:58
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:13:55
|
LL | async fn c(self: Pin<&Self>, f: &Foo, g: &Foo) -> (Pin<&Foo>, &Foo) { (self, f) }
| ----- ^^^^^^^^^^^^^^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/arbitrary_self_types_pin_lifetime_mismatch-async.rs:19:58
|
LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| ----- ^^^
@ -83,6 +25,5 @@ LL | async fn bar<'a>(self: Alias<&Self>, arg: &'a ()) -> &() { arg }
| | ...but data from `arg` is returned here
| this parameter and the return type are declared with different lifetimes...
error: aborting due to 7 previous errors
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -61,15 +61,15 @@ Legends:
| `struct-async.rs`| ✓ | ✓ | N/A |
| `alias-async.rs`| ✓ | ✓ | N/A |
| `assoc-async.rs`| ✓ | ✓ | N/A |
| `ref-self-async.rs` | X | X | α ⟶ β + γ |
| `ref-mut-self-async.rs` | X | X | α ⟶ β + γ |
| `ref-struct-async.rs` | X | X | α ⟶ β + γ |
| `ref-mut-struct-async.rs` | X | X | α ⟶ β + γ |
| `ref-alias-async.rs` | X | X | ✓ ⟶ β + γ |
| `ref-assoc-async.rs` | X | X | ✓ ⟶ β + γ |
| `ref-mut-alias-async.rs` | X | X | ✓ ⟶ β + γ |
| `ref-self-async.rs` | X | ✓ | N/A |
| `ref-mut-self-async.rs` | X | ✓ | N/A |
| `ref-struct-async.rs` | X | ✓ | N/A |
| `ref-mut-struct-async.rs` | X | ✓ | N/A |
| `ref-alias-async.rs` | ✓ | ✓ | N/A |
| `ref-assoc-async.rs` | ✓ | ✓ | N/A |
| `ref-mut-alias-async.rs` | ✓ | ✓ | N/A |
| `lt-self-async.rs` | ✓ | ✓ | N/A
| `lt-struct-async.rs` | ✓ | ✓ | N/A
| `lt-alias-async.rs` | ✓ | ✓ | N/A
| `lt-assoc-async.rs` | ✓ | ✓ | N/A
| `lt-ref-self-async.rs` | X | X | α ⟶ β + γ
| `lt-ref-self-async.rs` | X | ✓ | N/A |

View File

@ -1,51 +1,123 @@
error[E0106]: missing lifetime specifier
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:15:42
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#28r
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:23:48
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:15:47
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| _______________________-_______________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:21:48
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#28r
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:29:57
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:21:53
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| _____________________________-_______________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:25:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#28r
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:35:57
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:25:62
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| _____________________________________-________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:29:57
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#28r
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:41:66
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:29:62
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| _____________________________________-________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:33:66
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#28r
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:47:62
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:33:71
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| _____________________________________________-_________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/lt-ref-self-async.rs:37:62
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#28r
error: aborting due to 6 previous errors
error: lifetime may not live long enough
--> $DIR/lt-ref-self-async.rs:37:67
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| _________________________________________-_________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
For more information about this error, try `rustc --explain E0106`.
error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0700`.

View File

@ -13,41 +13,29 @@ impl<'a> Struct<'a> {
// Test using `&self` sugar:
async fn ref_self(&self, f: &u32) -> &u32 {
//~^ ERROR cannot infer an appropriate lifetime
//~| ERROR missing lifetime specifier
f
f //~^ ERROR lifetime mismatch
}
// Test using `&Self` explicitly:
async fn ref_Self(self: &Self, f: &u32) -> &u32 {
//~^ ERROR cannot infer an appropriate lifetime
//~| ERROR missing lifetime specifier
f
f //~^ ERROR lifetime mismatch
}
async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
//~^ ERROR cannot infer an appropriate lifetime
//~| ERROR missing lifetime specifier
f
f //~^ ERROR lifetime mismatch
}
async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
//~^ ERROR cannot infer an appropriate lifetime
//~| ERROR missing lifetime specifier
f
f //~^ ERROR lifetime mismatch
}
async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
//~^ ERROR cannot infer an appropriate lifetime
//~| ERROR missing lifetime specifier
f
f //~^ ERROR lifetime mismatch
}
async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
//~^ ERROR cannot infer an appropriate lifetime
//~| ERROR missing lifetime specifier
f
f //~^ ERROR lifetime mismatch
}
}

View File

@ -1,159 +1,56 @@
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:15:42
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:23:48
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:21:48
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:25:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:29:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:35:57
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:41:66
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:33:66
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/lt-ref-self-async.rs:47:62
error[E0623]: lifetime mismatch
--> $DIR/lt-ref-self-async.rs:37:62
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error: cannot infer an appropriate lifetime
--> $DIR/lt-ref-self-async.rs:15:30
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 15:23
--> $DIR/lt-ref-self-async.rs:15:23
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 15:23
|
LL | async fn ref_self(&self, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 6 previous errors
error: cannot infer an appropriate lifetime
--> $DIR/lt-ref-self-async.rs:23:36
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 23:29
--> $DIR/lt-ref-self-async.rs:23:29
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 23:29
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/lt-ref-self-async.rs:29:45
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 29:37
--> $DIR/lt-ref-self-async.rs:29:37
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 29:37
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/lt-ref-self-async.rs:35:45
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 35:37
--> $DIR/lt-ref-self-async.rs:35:37
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 35:37
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/lt-ref-self-async.rs:41:54
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 41:45
--> $DIR/lt-ref-self-async.rs:41:45
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 41:45
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/lt-ref-self-async.rs:47:50
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 47:41
--> $DIR/lt-ref-self-async.rs:47:41
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 47:41
|
LL | async fn box_pin_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,43 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:24:74
|
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:30:84
|
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:36:84
|
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:42:93
|
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:48:93
|
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,3 +1,4 @@
// check-pass
// edition:2018
#![feature(async_await)]
@ -22,32 +23,22 @@ impl Struct {
// Test using multiple `&Self`:
async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
}

View File

@ -1,133 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:24:74
|
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:30:84
|
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:36:84
|
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:42:93
|
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/multiple-ref-self-async.rs:48:93
|
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: cannot infer an appropriate lifetime
--> $DIR/multiple-ref-self-async.rs:24:63
|
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
| ^ --- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 24:48
--> $DIR/multiple-ref-self-async.rs:24:48
|
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 24:48
|
LL | async fn wrap_ref_Self_ref_Self(self: Wrap<&Self, &Self>, f: &u8) -> &u8 + '_ {
| ^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/multiple-ref-self-async.rs:30:72
|
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 30:56
--> $DIR/multiple-ref-self-async.rs:30:56
|
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 30:56
|
LL | async fn box_wrap_ref_Self_ref_Self(self: Box<Wrap<&Self, &Self>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/multiple-ref-self-async.rs:36:72
|
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 36:56
--> $DIR/multiple-ref-self-async.rs:36:56
|
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 36:56
|
LL | async fn pin_wrap_ref_Self_ref_Self(self: Pin<Wrap<&Self, &Self>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/multiple-ref-self-async.rs:42:81
|
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 42:64
--> $DIR/multiple-ref-self-async.rs:42:64
|
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 42:64
|
LL | async fn box_box_wrap_ref_Self_ref_Self(self: Box<Box<Wrap<&Self, &Self>>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/multiple-ref-self-async.rs:48:81
|
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 48:64
--> $DIR/multiple-ref-self-async.rs:48:64
|
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 48:64
|
LL | async fn box_pin_wrap_ref_Self_ref_Self(self: Box<Pin<Wrap<&Self, &Self>>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,43 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:20:50
|
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:26:59
|
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:32:59
|
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:38:68
|
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:44:68
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,4 +1,5 @@
// edition:2018
// check-pass
#![feature(async_await)]
@ -18,32 +19,22 @@ impl Struct {
// feels like a bug.
async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
}

View File

@ -1,133 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:20:50
|
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:26:59
|
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:32:59
|
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:38:68
|
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-alias-async.rs:44:68
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: cannot infer an appropriate lifetime
--> $DIR/ref-alias-async.rs:20:38
|
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 20:30
--> $DIR/ref-alias-async.rs:20:30
|
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 20:30
|
LL | async fn ref_Alias(self: &Alias, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-alias-async.rs:26:47
|
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 26:38
--> $DIR/ref-alias-async.rs:26:38
|
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 26:38
|
LL | async fn box_ref_Alias(self: Box<&Alias>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-alias-async.rs:32:47
|
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 32:38
--> $DIR/ref-alias-async.rs:32:38
|
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 32:38
|
LL | async fn pin_ref_Alias(self: Pin<&Alias>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-alias-async.rs:38:56
|
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 38:46
--> $DIR/ref-alias-async.rs:38:46
|
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 38:46
|
LL | async fn box_box_ref_Alias(self: Box<Box<&Alias>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-alias-async.rs:44:56
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 44:46
--> $DIR/ref-alias-async.rs:44:46
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 44:46
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&Alias>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,43 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:21:77
|
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:27:86
|
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:33:86
|
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:39:95
|
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:45:95
|
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,4 +1,5 @@
// edition:2018
// check-pass
#![feature(async_await)]
@ -19,32 +20,22 @@ impl Trait for Struct {
impl Struct {
async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
}

View File

@ -1,133 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:21:77
|
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:27:86
|
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:33:86
|
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:39:95
|
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-assoc-async.rs:45:95
|
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: cannot infer an appropriate lifetime
--> $DIR/ref-assoc-async.rs:21:65
|
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 21:34
--> $DIR/ref-assoc-async.rs:21:34
|
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 21:34
|
LL | async fn ref_AssocType(self: &<Struct as Trait>::AssocType, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-assoc-async.rs:27:74
|
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 27:42
--> $DIR/ref-assoc-async.rs:27:42
|
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 27:42
|
LL | async fn box_ref_AssocType(self: Box<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-assoc-async.rs:33:74
|
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 33:42
--> $DIR/ref-assoc-async.rs:33:42
|
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 33:42
|
LL | async fn pin_ref_AssocType(self: Pin<&<Struct as Trait>::AssocType>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-assoc-async.rs:39:83
|
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 39:50
--> $DIR/ref-assoc-async.rs:39:50
|
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 39:50
|
LL | async fn box_box_ref_AssocType(self: Box<Box<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-assoc-async.rs:45:83
|
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 45:50
--> $DIR/ref-assoc-async.rs:45:50
|
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 45:50
|
LL | async fn box_pin_ref_AssocType(self: Box<Pin<&<Struct as Trait>::AssocType>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,43 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:17:54
|
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:23:63
|
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:29:63
|
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:35:72
|
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:41:72
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: aborting due to 5 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,7 +1,7 @@
// edition:2018
// check-pass
#![feature(async_await)]
#![feature(arbitrary_self_types)]
#![allow(non_snake_case)]
@ -15,32 +15,22 @@ impl Struct {
// Test using an alias for `Struct`:
async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
}
}

View File

@ -1,133 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:17:54
|
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:23:63
|
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:29:63
|
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:35:72
|
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-alias-async.rs:41:72
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-alias-async.rs:17:42
|
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 17:30
--> $DIR/ref-mut-alias-async.rs:17:30
|
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 17:30
|
LL | async fn ref_Alias(self: &mut Alias, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-alias-async.rs:23:51
|
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 23:38
--> $DIR/ref-mut-alias-async.rs:23:38
|
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 23:38
|
LL | async fn box_ref_Alias(self: Box<&mut Alias>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-alias-async.rs:29:51
|
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 29:38
--> $DIR/ref-mut-alias-async.rs:29:38
|
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 29:38
|
LL | async fn pin_ref_Alias(self: Pin<&mut Alias>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-alias-async.rs:35:60
|
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 35:46
--> $DIR/ref-mut-alias-async.rs:35:46
|
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 35:46
|
LL | async fn box_box_ref_Alias(self: Box<Box<&mut Alias>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-alias-async.rs:41:60
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 41:46
--> $DIR/ref-mut-alias-async.rs:41:46
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 41:46
|
LL | async fn box_pin_ref_Alias(self: Box<Pin<&mut Alias>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,51 +1,123 @@
error[E0106]: missing lifetime specifier
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:15:46
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:23:52
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:15:51
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| _______________________-___________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:21:52
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:29:61
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:21:57
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| _____________________________-___________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:25:61
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:35:61
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:25:66
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| _____________________________________-____________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:29:61
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:41:70
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:29:66
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| _____________________________________-____________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:33:70
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:47:70
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:33:75
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| _____________________________________________-_____________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-self-async.rs:37:70
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error: aborting due to 6 previous errors
error: lifetime may not live long enough
--> $DIR/ref-mut-self-async.rs:37:75
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| _____________________________________________-_____________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
For more information about this error, try `rustc --explain E0106`.
error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0700`.

View File

@ -12,42 +12,30 @@ struct Struct { }
impl Struct {
// Test using `&mut self` sugar:
async fn ref_self(&mut self, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
async fn ref_self(&mut self, f: &u32) -> &u32 { //~ ERROR lifetime mismatch
f
}
// Test using `&mut Self` explicitly:
async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
}

View File

@ -1,159 +1,56 @@
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:15:46
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| --------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:23:52
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:21:52
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| --------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:25:61
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| --------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:29:61
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:35:61
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| --------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:41:70
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:33:70
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| --------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-self-async.rs:47:70
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-self-async.rs:37:70
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| --------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-self-async.rs:15:34
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 15:23
--> $DIR/ref-mut-self-async.rs:15:23
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 15:23
|
LL | async fn ref_self(&mut self, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 6 previous errors
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-self-async.rs:23:40
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 23:29
--> $DIR/ref-mut-self-async.rs:23:29
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 23:29
|
LL | async fn ref_Self(self: &mut Self, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-self-async.rs:29:49
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 29:37
--> $DIR/ref-mut-self-async.rs:29:37
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 29:37
|
LL | async fn box_ref_Self(self: Box<&mut Self>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-self-async.rs:35:49
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 35:37
--> $DIR/ref-mut-self-async.rs:35:37
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 35:37
|
LL | async fn pin_ref_Self(self: Pin<&mut Self>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-self-async.rs:41:58
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 41:45
--> $DIR/ref-mut-self-async.rs:41:45
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 41:45
|
LL | async fn box_box_ref_Self(self: Box<Box<&mut Self>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-self-async.rs:47:58
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 47:45
--> $DIR/ref-mut-self-async.rs:47:45
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 47:45
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&mut Self>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 12 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,43 +1,103 @@
error[E0106]: missing lifetime specifier
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:15:56
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-struct-async.rs:21:65
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:15:61
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| _______________________________-_____________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:19:65
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-struct-async.rs:27:65
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:19:70
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| _______________________________________-______________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:23:65
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-struct-async.rs:33:74
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:23:70
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| _______________________________________-______________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:27:74
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-struct-async.rs:39:74
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:27:79
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| _______________________________________________-_______________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-mut-struct-async.rs:31:74
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error: aborting due to 5 previous errors
error: lifetime may not live long enough
--> $DIR/ref-mut-struct-async.rs:31:79
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| _______________________________________________-_______________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
For more information about this error, try `rustc --explain E0106`.
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0700`.

View File

@ -13,33 +13,23 @@ impl Struct {
// Test using `&mut Struct` explicitly:
async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
}

View File

@ -1,133 +1,47 @@
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:15:56
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-struct-async.rs:21:65
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:19:65
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-struct-async.rs:27:65
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:23:65
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-struct-async.rs:33:74
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:27:74
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-mut-struct-async.rs:39:74
error[E0623]: lifetime mismatch
--> $DIR/ref-mut-struct-async.rs:31:74
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-struct-async.rs:15:44
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 15:31
--> $DIR/ref-mut-struct-async.rs:15:31
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 15:31
|
LL | async fn ref_Struct(self: &mut Struct, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 5 previous errors
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-struct-async.rs:21:53
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 21:39
--> $DIR/ref-mut-struct-async.rs:21:39
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 21:39
|
LL | async fn box_ref_Struct(self: Box<&mut Struct>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-struct-async.rs:27:53
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 27:39
--> $DIR/ref-mut-struct-async.rs:27:39
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 27:39
|
LL | async fn pin_ref_Struct(self: Pin<&mut Struct>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-struct-async.rs:33:62
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 33:47
--> $DIR/ref-mut-struct-async.rs:33:47
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 33:47
|
LL | async fn box_box_ref_Struct(self: Box<Box<&mut Struct>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-mut-struct-async.rs:39:62
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 39:47
--> $DIR/ref-mut-struct-async.rs:39:47
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 39:47
|
LL | async fn box_pin_ref_Struct(self: Box<Pin<&mut Struct>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,59 +1,143 @@
error[E0106]: missing lifetime specifier
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:24:42
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:32:48
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:24:47
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| _______________________-_______________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:30:48
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:38:57
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:30:53
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| _____________________________-_______________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:34:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:44:57
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:34:62
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| _____________________________________-________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:38:57
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:50:66
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:38:62
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| _____________________________________-________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:42:66
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:56:66
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:42:71
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| _____________________________________________-_________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:46:66
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:62:69
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:46:71
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| _____________________________________________-_________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-self-async.rs:50:69
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ^
| ^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error: aborting due to 7 previous errors
error: lifetime may not live long enough
--> $DIR/ref-self-async.rs:50:73
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ____________________________________________-____________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
For more information about this error, try `rustc --explain E0106`.
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0700`.

View File

@ -21,48 +21,34 @@ impl<T, P> Deref for Wrap<T, P> {
impl Struct {
// Test using `&self` sugar:
async fn ref_self(&self, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
async fn ref_self(&self, f: &u32) -> &u32 { //~ ERROR lifetime mismatch
f
}
// Test using `&Self` explicitly:
async fn ref_Self(self: &Self, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
}

View File

@ -1,185 +1,65 @@
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:24:42
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:32:48
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:30:48
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:34:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:38:57
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:44:57
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:50:66
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:42:66
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:56:66
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:46:66
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-self-async.rs:62:69
error[E0623]: lifetime mismatch
--> $DIR/ref-self-async.rs:50:69
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ----- ^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error: cannot infer an appropriate lifetime
--> $DIR/ref-self-async.rs:24:30
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 24:23
--> $DIR/ref-self-async.rs:24:23
|
LL | async fn ref_self(&self, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 24:23
|
LL | async fn ref_self(&self, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 7 previous errors
error: cannot infer an appropriate lifetime
--> $DIR/ref-self-async.rs:32:36
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 32:29
--> $DIR/ref-self-async.rs:32:29
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 32:29
|
LL | async fn ref_Self(self: &Self, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-self-async.rs:38:45
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 38:37
--> $DIR/ref-self-async.rs:38:37
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 38:37
|
LL | async fn box_ref_Self(self: Box<&Self>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-self-async.rs:44:45
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 44:37
--> $DIR/ref-self-async.rs:44:37
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 44:37
|
LL | async fn pin_ref_Self(self: Pin<&Self>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-self-async.rs:50:54
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 50:45
--> $DIR/ref-self-async.rs:50:45
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 50:45
|
LL | async fn box_box_ref_Self(self: Box<Box<&Self>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-self-async.rs:56:54
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 56:45
--> $DIR/ref-self-async.rs:56:45
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 56:45
|
LL | async fn box_pin_ref_Self(self: Box<Pin<&Self>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-self-async.rs:62:58
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ^ --- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 62:44
--> $DIR/ref-self-async.rs:62:44
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 62:44
|
LL | async fn wrap_ref_Self_Self(self: Wrap<&Self, Self>, f: &u8) -> &u8 + '_ {
| ^^^^^^^^
error: aborting due to 14 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,43 +1,103 @@
error[E0106]: missing lifetime specifier
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:15:52
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-struct-async.rs:21:61
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:15:57
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| _______________________________-_________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:19:61
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-struct-async.rs:27:61
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:19:66
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| _______________________________________-__________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:23:61
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-struct-async.rs:33:70
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:23:66
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| _______________________________________-__________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:27:70
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error[E0106]: missing lifetime specifier
--> $DIR/ref-struct-async.rs:39:66
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:27:75
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| _______________________________________________-___________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> $DIR/ref-struct-async.rs:31:66
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ^
| ^^^^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
= note: hidden type `impl std::future::Future` captures lifetime '_#18r
error: aborting due to 5 previous errors
error: lifetime may not live long enough
--> $DIR/ref-struct-async.rs:31:71
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ___________________________________________-___________________________^
| | |
| | lifetime `'_` defined here
| | lifetime `'_` defined here
LL | | f
LL | | }
| |_____^ function was supposed to return data with lifetime `'_` but it is returning data with lifetime `'_`
For more information about this error, try `rustc --explain E0106`.
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0700`.

View File

@ -13,33 +13,23 @@ impl Struct {
// Test using `&Struct` explicitly:
async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
f
f //~^ ERROR lifetime mismatch
}
}

View File

@ -1,133 +1,47 @@
error[E0106]: missing lifetime specifier
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:15:52
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-struct-async.rs:21:61
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:19:61
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-struct-async.rs:27:61
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:23:61
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-struct-async.rs:33:70
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:27:70
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error[E0106]: missing lifetime specifier
--> $DIR/ref-struct-async.rs:39:66
error[E0623]: lifetime mismatch
--> $DIR/ref-struct-async.rs:31:66
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
| ------- ^^^^
| | |
| | ...but data from `f` is returned here
| this parameter and the return type are declared with different lifetimes...
error: cannot infer an appropriate lifetime
--> $DIR/ref-struct-async.rs:15:40
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 15:31
--> $DIR/ref-struct-async.rs:15:31
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 15:31
|
LL | async fn ref_Struct(self: &Struct, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 5 previous errors
error: cannot infer an appropriate lifetime
--> $DIR/ref-struct-async.rs:21:49
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 21:39
--> $DIR/ref-struct-async.rs:21:39
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 21:39
|
LL | async fn box_ref_Struct(self: Box<&Struct>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-struct-async.rs:27:49
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 27:39
--> $DIR/ref-struct-async.rs:27:39
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 27:39
|
LL | async fn pin_ref_Struct(self: Pin<&Struct>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-struct-async.rs:33:58
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 33:47
--> $DIR/ref-struct-async.rs:33:47
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 33:47
|
LL | async fn box_box_ref_Struct(self: Box<Box<&Struct>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: cannot infer an appropriate lifetime
--> $DIR/ref-struct-async.rs:39:54
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ^ ---- this return type evaluates to the `'static` lifetime...
| |
| ...but this borrow...
|
note: ...can't outlive the lifetime '_ as defined on the method body at 39:43
--> $DIR/ref-struct-async.rs:39:43
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 {
| ^
help: you can add a constraint to the return type to make it last less than `'static` and match the lifetime '_ as defined on the method body at 39:43
|
LL | async fn box_pin_Struct(self: Box<Pin<&Struct>>, f: &u32) -> &u32 + '_ {
| ^^^^^^^^^
error: aborting due to 10 previous errors
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,11 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/self_lifetime-async.rs:9:44
|
LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found none.
error: aborting due to previous error
For more information about this error, try `rustc --explain E0106`.

View File

@ -1,5 +1,4 @@
// FIXME: Investigate why `self_lifetime.rs` is check-pass but this isn't.
// check-pass
// edition:2018
#![feature(async_await)]
@ -7,14 +6,11 @@
struct Foo<'a>(&'a ());
impl<'a> Foo<'a> {
async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
//~^ ERROR missing lifetime specifier
//~| ERROR cannot infer an appropriate lifetime
}
type Alias = Foo<'static>;
impl Alias {
async fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg }
//~^ ERROR lifetime mismatch
}
fn main() {}

View File

@ -1,39 +0,0 @@
error[E0106]: missing lifetime specifier
--> $DIR/self_lifetime-async.rs:9:44
|
LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found none.
error[E0495]: cannot infer an appropriate lifetime due to conflicting requirements
--> $DIR/self_lifetime-async.rs:9:22
|
LL | async fn foo<'b>(self: &'b Foo<'a>) -> &() { self.0 }
| ^^^^
|
note: first, the lifetime cannot outlive the lifetime 'a as defined on the impl at 8:6...
--> $DIR/self_lifetime-async.rs:8:6
|
LL | impl<'a> Foo<'a> {
| ^^
= note: ...so that the expression is assignable:
expected &Foo<'_>
found &'b Foo<'a>
= note: but, the lifetime must be valid for the static lifetime...
= note: ...so that the types are compatible:
expected &()
found &'static ()
error[E0623]: lifetime mismatch
--> $DIR/self_lifetime-async.rs:16:52
|
LL | async fn bar<'a>(self: &Alias, arg: &'a ()) -> &() { arg }
| ------ ^^^
| | |
| | ...but data from `arg` is returned here
| this parameter and the return type are declared with different lifetimes...
error: aborting due to 3 previous errors
For more information about this error, try `rustc --explain E0106`.