Add support for unsafe extern blocks by pvdrz · Pull Request #3015 · rust-lang/rust-bindgen (original) (raw)

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 andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Conversation6 Commits4 Checks29 Files changed

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

pvdrz

@ojeda ojeda mentioned this pull request

Dec 1, 2024

33 tasks

emilio

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't review all the test changes but given the patch I'm pretty confident they're just more unsafe keywords. So looks good :)

@pvdrz

we're getting lots of semantic merge conflicts lately 🤣

@pvdrz pvdrz deleted the pvdrz/unsafe-extern-blocks branch

December 2, 2024 20:17

@Kriskras99

I think there might be a bug with the version matching:

error: extern block cannot be declared unsafe
    --> /home/christiaan/scate2-dev/rust/target/release/build/flexnet_client-sys-a77799b3d52b9432/out/bindings.rs:3363:1
     |
3363 | unsafe extern "C" {
     | ^^^^^^
     |
     = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information

error: extern block cannot be declared unsafe
    --> /home/christiaan/scate2-dev/rust/target/release/build/flexnet_client-sys-a77799b3d52b9432/out/bindings.rs:3371:1
     |
3371 | unsafe extern "C" {
     | ^^^^^^
     |
     = note: see issue #123743 <https://github.com/rust-lang/rust/issues/123743> for more information

error: could not compile `flexnet_client-sys` (lib) due to 243 previous errors
warning: build failed, waiting for other jobs to finish...
christiaan@CBHST34:~/scate2-dev/rust$ rustc --version
rustc 1.81.0 (eeb90cda1 2024-09-04)

This is with bindgen = { version = "0.71.1" }

@pvdrz pvdrz mentioned this pull request

Dec 10, 2024

@ydirson

Same here with Rust 1.77, this code seems to be enabled by error.

phial3 pushed a commit to phial3/ffmpeg-third that referenced this pull request

Jan 14, 2025

@riptl riptl mentioned this pull request

Jan 27, 2025

alistair23 added a commit to westerndigitalcorporation/spdm-utils that referenced this pull request

Mar 5, 2025

@alistair23

OpenEmbedded now supports Rust 1.82 and using 1.82 for bindgen allows us to support the 2024 eddition [1].

1: rust-lang/rust-bindgen#3015

Signed-off-by: Alistair Francis alistair.francis@wdc.com

alistair23 added a commit to westerndigitalcorporation/spdm-utils that referenced this pull request

Mar 5, 2025

@alistair23

OpenEmbedded now supports Rust 1.82 and using 1.82 for bindgen allows us to support the 2024 eddition [1].

1: rust-lang/rust-bindgen#3015

Signed-off-by: Alistair Francis alistair.francis@wdc.com

alistair23 added a commit to westerndigitalcorporation/spdm-utils that referenced this pull request

Mar 5, 2025

@alistair23

OpenEmbedded now supports Rust 1.82 and using 1.82 for bindgen allows us to support the 2024 eddition [1].

1: rust-lang/rust-bindgen#3015

Signed-off-by: Alistair Francis alistair.francis@wdc.com

@sksat sksat mentioned this pull request

Mar 12, 2025

1 task

@theoparis

This PR isn't working for me on rust 1.85 stable:

  Unable to generate bindings: UnsupportedEdition(Edition2024, RustTarget(Stable(82, 0)))
$ rustc --version
rustc 1.85.0 (4d91de4e4 2025-02-17)

Edit: nevermind, I had to specify both rust_edition AND rust_target

@decathorpe

This PR isn't working for me on rust 1.85 stable:

 Unable to generate bindings: UnsupportedEdition(Edition2024, RustTarget(Stable(82, 0)))
$ rustc --version
rustc 1.85.0 (4d91de4e4 2025-02-17)

Edit: nevermind, I had to specify both rust_edition AND rust_target

Hm ... is that a bug then? At least the CLI help says that the edition should be by default compatible with the chosen target:

      --rust-edition <EDITION>
          Rust edition to target. Defaults to the latest edition supported by the chosen Rust target. Possible values: (2018|2021|2024).