Skip to content

bindgen 0.71 introduces regression referencing proc_macro2::Literal::c_string #3149

Closed
@yrp604

Description

@yrp604

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions