dtolnay/cxx

Support higher rank function pointers

Open

#817 创建于 2021年4月9日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)Rust (4,472 star) (253 fork)batch import
help wanted

描述

#[cxx::bridge]
mod ffi {
    extern "Rust" {
        type Thing<'a>;
    }

    unsafe extern "C++" {
        fn f(callback: for<'a> fn(&mut Thing<'a>, &mut Thing<'a>));
    }
}

Currently rejected:

error: function pointer with lifetime parameters is not supported yet
 --> src/main.rs:8:24
  |
8 |         fn f(callback: for<'a> fn(&mut Thing<'a>, &mut Thing<'a>));
  |                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

贡献者指南