Closed
Description
When updating a crate of mine to bindgen 0.71, I started receiving this error:
C:\Users\x\OneDrive\Documents\bad64\bad64-sys>cargo check
Updating crates.io index
Locking 2 packages to latest compatible versions
Updating bindgen v0.70.1 -> v0.71.1
Updating rustc-hash v1.1.0 -> v2.1.1
Compiling proc-macro2 v1.0.69
Compiling clang-sys v1.8.1
Compiling bindgen v0.71.1
Compiling rustc-hash v2.1.1
Compiling quote v1.0.33
Compiling syn v2.0.39
Compiling prettyplease v0.2.15
error[E0599]: no function or associated item named `c_string` found for struct `proc_macro2::Literal` in the current scope
--> C:\Users\x\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\bindgen-0.71.1\codegen\mod.rs:734:62
|
734 | ... let cstr = proc_macro2::Literal::c_string(cstr);
| ^^^^^^^^ function or associated item not found in `Literal`
|
note: if you're trying to build a new `proc_macro2::Literal` consider using one of the following associated functions:
proc_macro2::Literal::u8_suffixed
proc_macro2::Literal::u16_suffixed
proc_macro2::Literal::u32_suffixed
proc_macro2::Literal::u64_suffixed
and 28 others
--> C:\Users\x\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\proc-macro2-1.0.69\src\lib.rs:1097:5
|
1097 | / suffixed_int_literals! {
1098 | | u8_suffixed => u8,
1099 | | u16_suffixed => u16,
1100 | | u32_suffixed => u32,
... |
1109 | | isize_suffixed => isize,
1110 | | }
| |_____^
= note: this error originates in the macro `suffixed_int_literals` (in Nightly builds, run with -Z macro-backtrace for more info)
help: there is an associated function `string` with a similar name
|
734 - let cstr = proc_macro2::Literal::c_string(cstr);
734 + let cstr = proc_macro2::Literal::string(cstr);
|
For more information about this error, try `rustc --explain E0599`.
error: could not compile `bindgen` (lib) due to 1 previous error
This does not occur with bindgen 0.70.
I've pushed the relevant repro branch here: https://github.com/yrp604/bad64-sys/tree/bindgen-repro, and it should repro with cargo check
. This repros on both Windows and Linux, nightly and stable.
Activity
yrp604 commentedon Feb 23, 2025
This has stopped reproducing on my machine after reporting this.... I am very confused as to how or why, but apologies for the noise.
schmitch commentedon Feb 27, 2025
actually I have exactly the same problem, after updaing a dependency which updates bindgen to 0.7 hm
AzHicham commentedon Mar 11, 2025
Hello I have the same exact issue on Ubuntu 22.04 & Macos 14.
On a Renovate deps update bindgen 0.70 -> 0.71
https://github.com/AzHicham/openslide-sys/actions/runs/13652045388/job/38162635083?pr=96#step:6:71
Fireronin commentedon Mar 25, 2025
I also have this issue, on ubuntu with rust nightly 1.87
wentasah commentedon Mar 27, 2025
This was fixed by #3048, which was merged just after 0.71.1 release. In my project, the problem disappeared after running
cargo update proc-macro2 --precise 1.0.80
.MarijnS95 commentedon Apr 24, 2025
Would it make sense to add a
cargo +nightly -Zminimal-versions generate-lockfile
step to the CI to prevent similar mistakes in the future? This fix still hasn't made it into a subsequent (patch) release, requiring downstream crates that do check their minimum version bounds to manually make an exception and bump theproc-macro2
crate.