You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$ bindgen main.cc --enable-cxx-namespaces/* automatically generated by rust-bindgen 0.70.1 */#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]pub mod root { #[allow(unused_imports)] use self::super::root; pub mod repro { #[allow(unused_imports)] use self::super::super::root; pub mod __1 { #[allow(unused_imports)] use self::super::super::super::root; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct duration { pub _address: u8, } #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { ["Size of duration"][::std::mem::size_of::<duration>() - 1usize]; ["Alignment of duration"][::std::mem::align_of::<duration>() - 1usize]; }; } }}
Bindgen is incorrectly generating root::repro::__1::duration instead of root::repro::duration. If the 2 defines are placed into main.cc instead of namespace.h, the behavior is different.
#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]pub mod root { #[allow(unused_imports)] use self::super::root; pub mod repro { #[allow(unused_imports)] use self::super::super::root; #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct duration { pub _address: u8, } #[allow(clippy::unnecessary_operation, clippy::identity_op)] const _: () = { ["Size of duration"][::std::mem::size_of::<duration>() - 1usize]; ["Alignment of duration"][::std::mem::align_of::<duration>() - 1usize]; }; }}
As of current master, the logic by which bindgen decides whether a namespace is inline is here:
The following is minimized from Xcode's C++ standard library implementation.
Bindgen is incorrectly generating
root::repro::__1::duration
instead ofroot::repro::duration
. If the 2 defines are placed into main.cc instead of namespace.h, the behavior is different.As of current master, the logic by which bindgen decides whether a namespace is inline is here:
rust-bindgen/bindgen/ir/context.rs
Lines 2267 to 2286 in af26991
It should be using https://docs.rs/clang-sys/1.8.1/clang_sys/fn.clang_Cursor_isInlineNamespace.html instead, which I confirmed fixes this bug.
The text was updated successfully, but these errors were encountered: