cbindgen icon indicating copy to clipboard operation
cbindgen copied to clipboard

must_use on function pointers

Open TheBlueMatt opened this issue 5 years ago • 0 comments

I have some code which translates rust traits into a struct with function pointers, which is then fed through cbindgen to get C bindings for a Rust trait. However, I'd like to set must_use on those functions. clang seems perfectly happy to warn if you don't use the result of a function pointer if __attribute__((warn_unused_result)) is set, and Rust doesn't complain if you set #[must_use] similarly on a function pointer (though I didn't check what it actually means in Rust), but cbindgen doesn't translate the Rust #[must_use] to a must_use definition in the header.

TheBlueMatt avatar Jun 08 '20 22:06 TheBlueMatt