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. #15

Open
virtualritz opened this issue Aug 29, 2024 · 2 comments
Open

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

virtualritz opened this issue Aug 29, 2024 · 2 comments

Comments

@virtualritz
Copy link

The babble Rust plugin 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`
@anderslanglands
Copy link
Owner

Huh, interesting. Does it still build correcly in 2021 with the unsafe added?

@virtualritz
Copy link
Author

Huh, interesting. Does it still build correcly in 2021 with the unsafe added?

Yes it does.

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