rust-lang / cc-rs

Rust library for build scripts to compile C/C++ code into a Rust library
https://docs.rs/cc
Apache License 2.0
1.81k stars 434 forks source link

Fix safety comment for LibraryHandle::get_proc_address #1010

Closed NobodyXu closed 6 months ago

NobodyXu commented 6 months ago

Fix https://github.com/rust-lang/cc-rs/pull/957#discussion_r1525614843

I can't add lifetime to the return type directly, I can only add bound to the generic F.

However, I don't think we can add lifetime to function pointer, a newtype that dereferences to F would have the same problem since function pointer is copyable, so the only option is to add a safety comment for this unsafe function.