Skip to content

Conversation

eeeebbbbrrrr
Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr commented Mar 17, 2025

The problem here is that pgrx-bindgen's rust_fmt() step was (silently) failing because rustfmt without --edition 2021 doesn't understand rust c"C Cstrings".

This is necessary in order for `rustfmt` to understand our
(relatively-new) usages of rust `c"C Strings"`.

However, the word `gen` has been promoted to a keyword in 2024 edition,
which borks `rustfmt` in a different way.  Fixing this requires that we
have a version of bindgen with
rust-lang/rust-bindgen#3100, which, of course,
has not been released yet.  So I don't know where to go next.
@YohDeadfall
Copy link
Contributor

It's incredibly annoying to not have our pgXX.rs file be formatted.

That explains the issue I faced today where one of these files contained a single line of code and therefore was useless.

@eeeebbbbrrrr
Copy link
Contributor Author

I've updated this PR to set

bindgen = { git = "https://github.com/rust-lang/rust-bindgen.git", rev = "20aa65a", features = ["experimental", "runtime"] }

In pgrx-bindgen/Cargo.toml. We gotta do it. It's surprising to me that the bindgen folks haven't released something that's compatible with Edition 2024 yet, but here we are.

Assuming CI passes, I'm going to merge this.

@eeeebbbbrrrr
Copy link
Contributor Author

error: all dependencies must have a version specified when packaging.
dependency `bindgen` does not specify a version
Note: The packaged dependency will use the version from crates.io,
the `git` specification will be removed from the dependency declaration.

Dangit.
giphy

@YohDeadfall
Copy link
Contributor

Sign together with Niko about your dependencies: https://youtu.be/thdpaw_3VTw

@usamoi
Copy link
Contributor

usamoi commented Mar 20, 2025

pgrx-pg-sys still uses edition = "2021". What about just using --edition 2021? A few months later, when we try to update pgrx to edition = "2024", bindgen might have released a new version by then.

@eeeebbbbrrrr
Copy link
Contributor Author

Hmm. I didn’t try that. I’ll give it a shot and see what happens.

@eeeebbbbrrrr eeeebbbbrrrr changed the title Instruct rustfmt to use --edition 2024 Instruct rustfmt to use --edition 2021 Mar 28, 2025
@eeeebbbbrrrr eeeebbbbrrrr merged commit 6bfc992 into pgcentralfoundation:develop Mar 28, 2025
16 checks passed
KenjiBrown pushed a commit to SoftwareLibreMx/pgrx that referenced this pull request May 27, 2025
The problem here is that `pgrx-bindgen`'s `rust_fmt()` step was
(silently) failing because `rustfmt` without `--edition 2021` doesn't
understand rust `c"C Cstrings"`.
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.

3 participants