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

Add support for unsafe extern blocks #3015

Merged
merged 4 commits into from
Dec 2, 2024
Merged

Conversation

pvdrz
Copy link
Contributor

@pvdrz pvdrz commented Dec 1, 2024

This PR adds support for the unsafe_extern_blocks feature which was stabilized for Rust 1.82.

This feature is activated whenever the Rust target is greater or equal than 1.82.

Fixes #2901

cc pgcentralfoundation/pgrx#1810

@pvdrz pvdrz requested a review from emilio December 1, 2024 01:44
@pvdrz pvdrz force-pushed the pvdrz/unsafe-extern-blocks branch 2 times, most recently from eebb350 to 970f8b6 Compare December 2, 2024 02:53
Copy link
Contributor

@emilio emilio left a comment

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 :)

@emilio emilio added this pull request to the merge queue Dec 2, 2024
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Dec 2, 2024
@pvdrz pvdrz force-pushed the pvdrz/unsafe-extern-blocks branch from 970f8b6 to 460065e Compare December 2, 2024 17:36
@pvdrz
Copy link
Contributor Author

pvdrz commented Dec 2, 2024

we're getting lots of semantic merge conflicts lately 🤣

@pvdrz pvdrz enabled auto-merge December 2, 2024 17:38
@pvdrz pvdrz added this pull request to the merge queue Dec 2, 2024
Merged via the queue into main with commit d8dbe3e Dec 2, 2024
28 checks passed
@pvdrz pvdrz deleted the pvdrz/unsafe-extern-blocks branch December 2, 2024 20:17
@Kriskras99
Copy link
Contributor

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" }

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

Successfully merging this pull request may close these issues.

Generate unsafe extern blocks (Edition 2024)
3 participants