Closed nirui closed 5 years ago
This looks like it affects any function with a signature resembling async fn<'a>(&A, &'static B) -> &'a C
, not anything about async-trait. Could you make sure there is an issue filed for this in rust-lang/rust?
Minimized further:
async fn test<'a>(_: &(), _: &'static ()) -> &'a () {
unimplemented!()
}
error[E0700]: hidden type for `impl Trait` captures lifetime that does not appear in bounds
--> src/main.rs:1:46
|
1 | async fn test<'a>(_: &(), _: &'static ()) -> &'a () {
| ^^^^^^
|
note: hidden type `impl std::future::Future` captures the scope of call-site for function at 1:53
--> src/main.rs:1:53
|
1 | async fn test<'a>(_: &(), _: &'static ()) -> &'a () {
| _____________________________________________________^
2 | | unimplemented!()
3 | | }
| |_^
async fn test<'a>(_: &(), _: &'static ()) -> &'a () { unimplemented!() }
Nice catch! I'll investigate some more into the language itself.
Thank you for your time! And sorry for the bothering.
I just hit this same rust compiler bug in some code that doesn't use async trait. Did this ever get filed as a bug against rustc?
Looks like https://github.com/rust-lang/rust/issues/64552 might be related?
Hello,
I was trying to spawn an
async
block inside anotherasync
function withTokio
(which requires theasync
block to beFuture<Output = ()> + Send + 'static
, so I had to borrowother_trait
as'static
as well). Rust tells me somehow my code is an E0700.The minified version of my code as following:
Cargo.toml
file:Error message:
I'm still learning all the pieces of the puzzle of Rust, so I'm not sure about whether it's my mistake or a bug. Sorry for bothering if it's me been dumb :(
PS: I've read the #15, but not sure my problem is related.
Thank you!