Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'async_trait lifetime to impl Trait arguments #201

Merged
merged 3 commits into from Jun 2, 2022
Merged

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Jun 2, 2022

Fixes #177.

Currently fails with:

    error[E0309]: the parameter type `impl FnMut(&'life1 str) + Send` may not live long enough
        --> tests/test.rs:1383:68
         |
    1383 |         async fn foo(&self, mut callback: impl FnMut(&str) + Send) {}
         |                                                                    ^^ ...so that the type `impl futures::Future<Output = ()>` will meet its required lifetime bounds
         |
    help: consider adding an explicit lifetime bound...
         |
    1383 |         async fn foo(&self, mut callback: impl FnMut(&str) + Send + 'async_trait) {}
         |                                                                   ++++++++++++++
@dtolnay dtolnay merged commit c3ef648 into master Jun 2, 2022
@dtolnay dtolnay deleted the impltrait branch June 2, 2022 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Lifetime issue when using "impl FnMut" as argument type
1 participant