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

must_use_type not working on type aliases #2186

Closed
matejcik opened this issue Apr 5, 2022 · 1 comment
Closed

must_use_type not working on type aliases #2186

matejcik opened this issue Apr 5, 2022 · 1 comment

Comments

@matejcik
Copy link

matejcik commented Apr 5, 2022

The #[must_use] attribute does not apply to type aliases, so it makes sense that bindgen won't put it on the alias itself.

However, it would be nice if it would put it on the functions returning the given type alias instead.

Input C/C++ Header

#include <stdint.h>

typedef uint32_t secbool;

secbool must_check(int i);

Bindgen Invocation

bindgen input.h --must-use-type secbool --allowlist-type secbool --allowlist-function must_check

Actual Results

/* automatically generated by rust-bindgen 0.59.2 */

pub type secbool = u32;
extern "C" {
    pub fn must_check(i: ::std::os::raw::c_int) -> secbool;
}

Expected Results

pub type secbool = u32;
extern "C" {
    #[must_use]
    pub fn must_check(i: ::std::os::raw::c_int) -> secbool;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant