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

Rust 2024 -- unsafe extern "C" hard req. #5

Closed
virtualritz opened this issue Aug 29, 2024 · 1 comment
Closed

Rust 2024 -- unsafe extern "C" hard req. #5

virtualritz opened this issue Aug 29, 2024 · 1 comment

Comments

@virtualritz
Copy link

virtualritz commented Aug 29, 2024

babble should emit unsafe extern "C" blocks instead of just extern "C".

See RFC 3484.

A specific error when running cargo fix --edition on a Rust 2021 babble project looks like this:

warning: extern blocks should be unsafe
    --> /home/moritz/code/crates/bbl-oiio/target/debug/build/openimageio-98c7a6140b96515b/out/build/oiio.rs:339:1
     |
339  |   extern "C" {
     |   ^
     |   |
     |  _help: needs `unsafe` before the extern keyword: `unsafe`
     | |
340  | |
341  | | pub fn oiio_CspanF32_ctor(data: *mut c_float, size: c_ulong, _result: *mut *mut oiio_CspanF32_t) -> c_int;
...    |
1644 | |
1645 | | }
     | |_^
     |
     = warning: this is accepted in the current edition (Rust 2021) but is a hard error in Rust 2024!
     = note: for more information, see issue #123743 <https://github.com/rust-lang/rust/issues/123743>
     = note: `--force-warn missing-unsafe-on-extern` implied by `--force-warn rust-2024-compatibility`
@virtualritz
Copy link
Author

Sorry, wrong repo. Re-filed here.

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

1 participant