-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-inferenceArea: Type inferenceArea: Type inferenceA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-type-systemArea: Type systemArea: Type systemAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsync-await issues that are part of the "polish" areaC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.
Description
Originally reported in #63383 (comment).
#![feature(async_await)]
#![feature(nll)]
// Without it you also get //~^ ERROR cannot infer an appropriate lifetime
struct A;
impl A {
async fn foo(&self, f: &u32) -> &A {
self
}
}
should compile (it does if you remove async
or write async fn foo<'a, 'b>(&'a self, f: &'b u32) -> &'a A
) but does not (playground):
error[E0106]: missing lifetime specifier
--> src/lib.rs:7:37
|
7 | async fn foo(&self, f: &u32) -> &A {
| ^
|
= note: return-position elided lifetimes require exactly one input-position elided lifetime, found multiple.
This seems like a rather serious usability bug as compared to what you expect from normal Rust.
cc #63209
cc @nikomatsakis @cramertj
Metadata
Metadata
Assignees
Labels
A-async-awaitArea: Async & AwaitArea: Async & AwaitA-inferenceArea: Type inferenceArea: Type inferenceA-lifetimesArea: Lifetimes / regionsArea: Lifetimes / regionsA-type-systemArea: Type systemArea: Type systemAsyncAwait-PolishAsync-await issues that are part of the "polish" areaAsync-await issues that are part of the "polish" areaC-bugCategory: This is a bug.Category: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.requires-nightlyThis issue requires a nightly compiler in some way.This issue requires a nightly compiler in some way.