Odd Lifetime error when compiling async fn with two non-static and one static reference #76550
Labels
A-async-await
Area: Async & Await
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
C-bug
Category: This is a bug.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I tried this code:
I expected to see this happen: The function should compile and be a no-op
Instead, this happened: The code fails to compile with the following error message
Meta
rustc --version --verbose
:I have reproduced this issue with 1.46.0 as well as nightly 1.48.0 2020-09-08, both in the Rust playground.
Solutions I tried:
async fn foo<'a>(x: &'a Foo, y: &'a Foo, z: &'static Foo) {}
x
andy
to the same lifetimeasync fn foo(x: &Foo, y: &Foo, z: &Foo) {}
z
async fn foo(x: &Foo, z: &'static Foo) {}
x
,y
, orz
async fn foo<'x, 'y>(x: &'x Foo, y: &'y Foo, z: &'static Foo) {}
x
andy
to independent lifetimesasync fn foo<'x, 'y: 'x>(x: &'x Foo, y: &'y Foo, z: &'static Foo) {}
x
andy
to lifetimes that are not independentThe text was updated successfully, but these errors were encountered: