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

static mut deprecation #2801

Open
wmmc88 opened this issue Apr 3, 2024 · 1 comment
Open

static mut deprecation #2801

wmmc88 opened this issue Apr 3, 2024 · 1 comment

Comments

@wmmc88
Copy link

wmmc88 commented Apr 3, 2024

There is a current pre-RFC for deprecating static mut in Rust 2024, in favor of better alternatives. I think bindgen should start using some of these alternatives instead of generating code that will become deprecated in the near-term. My understanding of the pre-RFC is that we should be using SyncUnsafeCell in these FFI scenarios instead of static mut

Input C/C++ Header

extern const void* FOO;

Bindgen Invocation

bindgen::Builder::default()
    .header("input.h")
    .generate()
    .unwrap()

Actual Results

extern "C" {
    pub static mut Foo: *const ::core::ffi::c_void;
}

Expected Results

@pvdrz
Copy link
Contributor

pvdrz commented Apr 3, 2024

SyncUnsafeCell is unstable which means we would have to implement this change and gate it behind nightly.

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

No branches or pull requests

2 participants