dtolnay / async-trait

Type erasure for async trait methods
Apache License 2.0
1.81k stars 84 forks source link

"elided_named_lifetimes" lint in latest Rust nightly #279

Closed nazar-pc closed 10 hours ago

nazar-pc commented 1 day ago

I have a function of this kind under async_trait:

    async fn contents(
        &self,
    ) -> Box<
          dyn Stream<Item = Result<ABC, FarmError>>
              + Unpin
              + Send
              + '_,
    > {
    }

In latest nightly I'm getting the following warning:

    |
111 |         &self,
    |         - lifetime `'life0` declared here
...
117 |                 + '_,
    |                   ^^ this elided lifetime gets resolved as `'life0`
    |
    = note: `#[warn(elided_named_lifetimes)]` on by default

It comes from generated code and I'm reluctant to actually writing 'life0 explicitly in such cases.

Would be nice to convert these it in the macro automatically.

dtolnay commented 10 hours ago

This was fixed several weeks ago.