Skip to content

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

Closed
@virtualritz

Description

@virtualritz

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`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions