rust-lang/rust-bindgen (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

thread 'main' panicked at '"__mbstate_t_(anonymous_struct_at_foo_cc_2_3)" is not a valid Ident' #2312

@glandium

Description

@glandium

This started happening on clang-trunk with llvm/llvm-project@19e984e

Input C/C++ Header

typedef struct { struct {}; } __mbstate_t;

Bindgen Invocation

bindgen::Builder::default() .header("foo.cc") .generate() .unwrap()

Actual Results

thread 'main' panicked at '"__mbstate_t_(anonymous_struct_at_foo_cc_2_3)" is not a valid Ident', /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.46/src/fallback.rs:756:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/a55dd71d5fb0ec5a6a3a9e8c27b2127ba491ce52/library/core/src/panicking.rs:142:14
   2: proc_macro2::fallback::validate_ident
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.46/src/fallback.rs:756:9
   3: proc_macro2::fallback::Ident::_new
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.46/src/fallback.rs:698:9
   4: proc_macro2::fallback::Ident::new
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.46/src/fallback.rs:708:9
   5: proc_macro2::Ident::new
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/proc-macro2-1.0.46/src/lib.rs:974:21
   6: bindgen::ir::context::BindgenContext::rust_ident_raw
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/ir/context.rs:861:9
   7: bindgen::ir::context::BindgenContext::rust_ident
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/ir/context.rs:853:9
   8: <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:1786:31
   9: <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:814:39
  10: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:500:17
  11: <bindgen::ir::comp::CompInfo as bindgen::codegen::CodeGenerator>::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:2115:13
  12: <bindgen::ir::ty::Type as bindgen::codegen::CodeGenerator>::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:814:39
  13: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:500:17
  14: <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen::{{closure}}
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:523:21
  15: <bindgen::ir::module::Module as bindgen::codegen::CodeGenerator>::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:553:13
  16: <bindgen::ir::item::Item as bindgen::codegen::CodeGenerator>::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:491:17
  17: bindgen::codegen::codegen::{{closure}}
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:4364:9
  18: bindgen::ir::context::BindgenContext::gen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/ir/context.rs:1173:19
  19: bindgen::codegen::codegen
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/codegen/mod.rs:4328:5
  20: bindgen::Bindings::generate
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/lib.rs:2438:32
  21: bindgen::Builder::generate
             at /home/glandium/.cargo/registry/src/github.com-1ecc6299db9ec823/bindgen-0.60.1/src/lib.rs:1502:9