Problem
We're seeing failures in our -Zminimal-versions check when trying to upgrade to libsqlite-sys = "0.34.0" (using bindgen = "0.72"): https://github.com/launchbadge/sqlx/actions/runs/16083515240/job/45391511117?pr=3922
error: failed to run custom build command for `libsqlite3-sys v0.34.0`
Caused by:
process didn't exit successfully: `/home/runner/work/sqlx/sqlx/target/debug/build/libsqlite3-sys-8d75a6a785f86c45/build-script-build` (exit status: 101)
--- stdout
cargo:rerun-if-env-changed=LIBSQLITE3_SYS_USE_PKG_CONFIG
cargo:rerun-if-env-changed=LIBSQLITE3_SYS_BUNDLING
--- stderr
thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/prettyplease-0.2.7/src/lit.rs:17:18:
not implemented: unknown Lit
This suggests that prettyplease = "0.2.7" is too old for whatever syntax bindgen is trying to generate here.
I edited the unimplemented!() at that line in prettyplease to actually print the literal, and it's a C-string literal:
Lit::CStr { token: c"3.49.2" }
After doing some digging, I've figured out that it's actually an issue with the bindgen configuration because generate_cstr is unconditionally set to true here:
Solutions
prettyplease 0.2.20 is already an optional dependency, so add it to the features enabled by buildtime-bindgen.
- Don't unconditionally pretty-print the generated code, and make it an optional feature or environment flag instead. This would likely speed up build times a bit, and 99% of the time no one is looking anyway. I presume this is mostly for debugging and making the source look nice when rendered by
docs.rs.
I'm happy to submit a patch for either option, I just need a decision made.
Workaround
Users can force prettyplease to a higher minimum version by adding it to their own [build-dependencies] section, as Cargo should unify it:
[build-dependencies]
# force `prettyplease` to the minimum version that supports C-string literals for `libsqlite3-sys 0.34.0`
prettyplease = "0.2.18"
Problem
We're seeing failures in our
-Zminimal-versionscheck when trying to upgrade tolibsqlite-sys = "0.34.0"(usingbindgen = "0.72"): https://github.com/launchbadge/sqlx/actions/runs/16083515240/job/45391511117?pr=3922This suggests that
prettyplease = "0.2.7"is too old for whatever syntaxbindgenis trying to generate here.I edited the
unimplemented!()at that line inprettypleaseto actually print the literal, and it's a C-string literal:Lit::CStr { token: c"3.49.2" }After doing some digging, I've figured out that it's actually an issue with the
bindgenconfiguration becausegenerate_cstris unconditionally set totruehere:rusqlite/libsqlite3-sys/build.rs
Line 548 in da7ba5a
Solutions
prettyplease 0.2.20is already an optional dependency, so add it to the features enabled bybuildtime-bindgen.docs.rs.I'm happy to submit a patch for either option, I just need a decision made.
Workaround
Users can force
prettypleaseto a higher minimum version by adding it to their own[build-dependencies]section, as Cargo should unify it: