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

Fix undeclared lifetime when fn ptr arg contains outer lifetime #828

Merged
merged 2 commits into from
Apr 10, 2021
Merged

Conversation

dtolnay
Copy link
Owner

@dtolnay dtolnay commented Apr 10, 2021

Fixes #739.

dtolnay added 2 commits April 10, 2021 15:14
Currently fails to build.

    error[E0261]: use of undeclared lifetime name `'a`
       --> tests/ffi/lib.rs:162:59
        |
    23  | #[cxx::bridge(namespace = "tests")]
        |                                    - lifetime `'a` is missing in item created through this procedural macro
    ...
    162 |         fn c_take_callback_ref_lifetime<'a>(callback: fn(&'a String));
        |                                                           ^^ undeclared lifetime
        |
        = note: for more information on higher-ranked polymorphism, visit https://doc.rust-lang.org/nomicon/hrtb.html
        = help: if you want to experiment with in-band lifetime bindings, add `#![feature(in_band_lifetimes)]` to the crate attributes
    help: consider making the type lifetime-generic with a new `'a` lifetime
        |
    162 |         fn c_take_callback_ref_lifetime<'a>(callback: for<'a> fn(&'a String));
        |                                                       ^^^^^^^
@dtolnay dtolnay merged commit 9baa962 into master Apr 10, 2021
@dtolnay dtolnay deleted the fn branch April 10, 2021 22:20
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.

Undeclared lifetime when function pointer argument contains lifetime from extern signature
1 participant