Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code for inner struct is not generated #527

Closed
kornelski opened this issue Feb 18, 2017 · 1 comment
Closed

Code for inner struct is not generated #527

kornelski opened this issue Feb 18, 2017 · 1 comment
Labels

Comments

@kornelski
Copy link
Contributor

kornelski commented Feb 18, 2017

The commit 7e1b7d9 broke this code:

Input C/C++ Header

struct s {
  union {
    struct inner {
      int b;
    } field;
  } u;
};

(this is from libvpx)

The inner struct is not generated, but the reference to it is used, so the Rust code doesn't compile.

error[E0412]: cannot find type s__bindgen_ty_1_inner in this scope
--> foo.rs:11:16
|
11 | pub field: s__bindgen_ty_1_inner,
| ^^^^^^^^^^^^^^^^^^^^^ did you mean s__bindgen_ty_1?

RUST_LOG=bindgen Output

INFO:bindgen: Clang Version: Apple LLVM version 8.1.0 (clang-802.0.30.2)
WARN:bindgen: Couldn't parse libclang version
DEBUG:bindgen::ir::context: BindgenContext::add_item(Item { id: ItemId(0), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(0), kind: Module(Module { name: Some("root"), kind: Normal, children_ids: [] }) }, declaration: None, loc: None
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(struct s, kind: Record, decl: Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s")), canon: Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s"))), Some(Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s"))), None
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(struct s, kind: Record, decl: Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s")), canon: Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s"))), Some(Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s"))), None
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::ty: from_clang_ty: ItemId(1), ty: Type(struct s, kind: Record, decl: Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s")), canon: Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s"))), loc: Some(Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s")))
DEBUG:bindgen::ir::ty: currently_parsed_types: [PartialType { decl: Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s")), id: ItemId(1) }]
DEBUG:bindgen::ir::comp: CompInfo::from_ty(Struct, Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s")))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(union s::(anonymous at vptest.h:12:3), kind: Record, decl: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")), canon: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), Some(Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(union s::(anonymous at vptest.h:12:3), kind: Record, decl: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")), canon: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), Some(Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::ty: from_clang_ty: ItemId(2), ty: Type(union s::(anonymous at vptest.h:12:3), kind: Record, decl: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")), canon: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), loc: Some(Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")))
DEBUG:bindgen::ir::ty: currently_parsed_types: [PartialType { decl: Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s")), id: ItemId(1) }, PartialType { decl: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")), id: ItemId(2) }]
DEBUG:bindgen::ir::comp: CompInfo::from_ty(Union, Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")))
DEBUG:bindgen::ir::item: from_ty_or_ref_with_id: ItemId(3) Type(struct inner, kind: Elaborated, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field"))), Some(ItemId(2))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(struct inner, kind: Elaborated, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field"))), Some(ItemId(2))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::item: New unresolved type reference: Type(struct inner, kind: Elaborated, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field")))
DEBUG:bindgen::ir::context: BindgenContext::add_item(Item { id: ItemId(3), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(2), kind: Type(Type { name: None, layout: None, kind: UnresolvedTypeRef(Type(struct inner, kind: Elaborated, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field"))), Some(ItemId(2))), is_const: false }) }, declaration: Some(Cursor( kind: InvalidFile, loc: builtin definitions, usr: None)), loc: None
DEBUG:bindgen::ir::context: Invalid declaration Cursor( kind: InvalidFile, loc: builtin definitions, usr: None) found for type Type { name: None, layout: None, kind: UnresolvedTypeRef(Type(struct inner, kind: Elaborated, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field"))), Some(ItemId(2))), is_const: false }
DEBUG:bindgen::ir::context: BindgenContext::add_item(Item { id: ItemId(2), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(1), kind: Type(Type { name: None, layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Union, fields: [Field { name: Some("field"), ty: ItemId(3), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }, declaration: Some(Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), loc: Some(Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")))
DEBUG:bindgen::ir::item: from_ty_or_ref_with_id: ItemId(4) Type(union (anonymous union at vptest.h:12:3), kind: Elaborated, decl: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")), canon: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), Some(Cursor(u kind: FieldDecl, loc: vptest.h:16:5, usr: Some("c:@S@s@FI@u"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(union (anonymous union at vptest.h:12:3), kind: Elaborated, decl: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")), canon: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), Some(Cursor(u kind: FieldDecl, loc: vptest.h:16:5, usr: Some("c:@S@s@FI@u"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: Already resolved ty ItemId(2), CanonicalTypeDeclaration(Type(union (anonymous union at vptest.h:12:3), kind: Elaborated, decl: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")), canon: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))), Type(union (anonymous union at vptest.h:12:3), kind: Elaborated, decl: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425")), canon: Cursor( kind: UnionDecl, loc: vptest.h:12:3, usr: Some("c:@S@s@U@vptest.h@425"))) Some(Cursor(u kind: FieldDecl, loc: vptest.h:16:5, usr: Some("c:@S@s@FI@u")))
DEBUG:bindgen::ir::context: add_builtin_item: item = Item { id: ItemId(4), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(1), kind: Type(Type { name: Some("union (anonymous union at vptest.h:12:3)"), layout: Some(Layout { size: 4, align: 4, packed: false }), kind: ResolvedTypeRef(ItemId(2)), is_const: false }) }
DEBUG:bindgen::ir::item: ItemId(4) already resolved: Some(Cursor(u kind: FieldDecl, loc: vptest.h:16:5, usr: Some("c:@S@s@FI@u")))
DEBUG:bindgen::ir::context: BindgenContext::add_item(Item { id: ItemId(1), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(0), kind: Type(Type { name: Some("s"), layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Struct, fields: [Field { name: Some("u"), ty: ItemId(4), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [ItemId(2)], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }, declaration: Some(Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s"))), loc: Some(Cursor(s kind: StructDecl, loc: vptest.h:11:8, usr: Some("c:@S@s")))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(struct inner, kind: Elaborated, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field"))), Some(ItemId(2))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(struct inner, kind: Elaborated, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field"))), Some(ItemId(2))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::ty: from_clang_ty: ItemId(5), ty: Type(struct inner, kind: Elaborated, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), loc: Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field")))
DEBUG:bindgen::ir::ty: currently_parsed_types: [PartialType { decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), id: ItemId(5) }]
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(struct inner, kind: Record, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field"))), Some(ItemId(2))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::ty: from_clang_ty: ItemId(5), ty: Type(struct inner, kind: Record, decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), canon: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), loc: Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field")))
DEBUG:bindgen::ir::ty: currently_parsed_types: [PartialType { decl: Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")), id: ItemId(5) }]
DEBUG:bindgen::ir::comp: CompInfo::from_ty(Struct, Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner")))
DEBUG:bindgen::ir::item: from_ty_or_ref_with_id: ItemId(6) Type(int, kind: Int, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Some(Cursor(b kind: FieldDecl, loc: vptest.h:14:11, usr: Some("c:@S@inner@FI@b"))), Some(ItemId(5))
DEBUG:bindgen::ir::item: refs already collected, resolving directly
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(int, kind: Int, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Some(Cursor(b kind: FieldDecl, loc: vptest.h:14:11, usr: Some("c:@S@inner@FI@b"))), Some(ItemId(5))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::context: add_builtin_item: item = Item { id: ItemId(7), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(0), kind: Type(Type { name: Some("int"), layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Int(Int), is_const: false }) }
DEBUG:bindgen::ir::context: BindgenContext::add_item(Item { id: ItemId(5), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(2), kind: Type(Type { name: Some("inner"), layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Struct, fields: [Field { name: Some("b"), ty: ItemId(7), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }, declaration: Some(Cursor(inner kind: StructDecl, loc: vptest.h:13:12, usr: Some("c:@S@inner"))), loc: Some(Cursor(field kind: FieldDecl, loc: vptest.h:15:7, usr: Some("c:@S@s@U@vptest.h@425@FI@field")))
DEBUG:bindgen::ir::context: No replacements to process
DEBUG:bindgen::codegen: codegen: BindgenOptions { hidden_types: RegexSet { items: [], set: Some(RegexSet([])) }, opaque_types: RegexSet { items: [], set: Some(RegexSet([])) }, whitelisted_types: RegexSet { items: [], set: Some(RegexSet([])) }, whitelisted_functions: RegexSet { items: [], set: Some(RegexSet([])) }, whitelisted_vars: RegexSet { items: [], set: Some(RegexSet([])) }, bitfield_enums: RegexSet { items: [], set: Some(RegexSet([])) }, constified_enums: RegexSet { items: [], set: Some(RegexSet([])) }, builtins: false, links: [], emit_ast: false, emit_ir: false, enable_cxx_namespaces: false, disable_name_namespacing: false, derive_debug: true, derive_default: false, unstable_rust: true, use_core: false, ctypes_prefix: None, namespaced_constants: true, msvc_mangling: false, convert_floats: true, raw_lines: [], clang_args: ["-isystem", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1", "-isystem", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/8.1.0/include", "-isystem", "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include", "-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/usr/include", "-isystem", "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks", "vptest.h"], input_header: Some("vptest.h"), dummy_uses: None, type_chooser: None, codegen_config: CodegenConfig { functions: true, types: true, vars: true, methods: true, constructors: true }, conservative_inline_namespaces: false, generate_comments: true, whitelist_recursively: true, objc_extern_crate: false }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = Item { id: ItemId(0), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(0), kind: Module(Module { name: Some("root"), kind: Normal, children_ids: [ItemId(1)] }) }
DEBUG:bindgen::codegen: <Module as CodeGenerator>::codegen: item = Item { id: ItemId(0), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(0), kind: Module(Module { name: Some("root"), kind: Normal, children_ids: [ItemId(1)] }) }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = Item { id: ItemId(1), local_id: Cell { value: None }, next_child_local_id: Cell { value: 2 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(0), kind: Type(Type { name: Some("s"), layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Struct, fields: [Field { name: Some("u"), ty: ItemId(4), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [ItemId(2)], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: item = Item { id: ItemId(1), local_id: Cell { value: None }, next_child_local_id: Cell { value: 2 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(0), kind: Type(Type { name: Some("s"), layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Struct, fields: [Field { name: Some("u"), ty: ItemId(4), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [ItemId(2)], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }
DEBUG:bindgen::codegen: <CompInfo as CodeGenerator>::codegen: item = Item { id: ItemId(1), local_id: Cell { value: None }, next_child_local_id: Cell { value: 2 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(0), kind: Type(Type { name: Some("s"), layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Struct, fields: [Field { name: Some("u"), ty: ItemId(4), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [ItemId(2)], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }
DEBUG:bindgen::codegen::struct_layout: align field u to 0/0 with 0 padding bytes Layout { size: 4, align: 4, packed: false }, calculated Layout { size: 4, align: 4, packed: false }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = Item { id: ItemId(2), local_id: Cell { value: Some(1) }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(1), kind: Type(Type { name: None, layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Union, fields: [Field { name: Some("field"), ty: ItemId(3), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: item = Item { id: ItemId(2), local_id: Cell { value: Some(1) }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(1), kind: Type(Type { name: None, layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Union, fields: [Field { name: Some("field"), ty: ItemId(3), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }
DEBUG:bindgen::codegen: <CompInfo as CodeGenerator>::codegen: item = Item { id: ItemId(2), local_id: Cell { value: Some(1) }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: None }, comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, parent_id: ItemId(1), kind: Type(Type { name: None, layout: Some(Layout { size: 4, align: 4, packed: false }), kind: Comp(CompInfo { kind: Union, fields: [Field { name: Some("field"), ty: ItemId(3), comment: None, annotations: Annotations { opaque: false, hide: false, use_instead_of: None, disallow_copy: false, private_fields: None, accessor_kind: None, constify_enum_variant: false }, bitfield: None, mutable: false, offset: Some(0) }], template_args: [], methods: [], constructors: [], base_members: [], ref_template: None, inner_types: [], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: false, packed: false, found_unknown_attr: false, detect_derive_debug_cycle: Cell { value: false }, detect_derive_default_cycle: Cell { value: false }, detect_has_destructor_cycle: Cell { value: false }, is_forward_declaration: false }), is_const: false }) }
DEBUG:bindgen::codegen::struct_layout: align field field to 0/0 with 0 padding bytes Layout { size: 4, align: 4, packed: false }, calculated Layout { size: 4, align: 4, packed: false }
/* automatically generated by rust-bindgen */

#[repr(C)]
#[derive(Copy)]
pub struct s {
    pub u: s__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy)]
pub union s__bindgen_ty_1 {
    pub field: s__bindgen_ty_1_inner,
}
#[test]
fn bindgen_test_layout_s__bindgen_ty_1() {
    assert_eq!(::std::mem::size_of::<s__bindgen_ty_1>() , 4usize , concat ! (
               "Size of: " , stringify ! ( s__bindgen_ty_1 ) ));
    assert_eq! (::std::mem::align_of::<s__bindgen_ty_1>() , 4usize , concat !
                ( "Alignment of " , stringify ! ( s__bindgen_ty_1 ) ));
    assert_eq! (unsafe {
                & ( * ( 0 as * const s__bindgen_ty_1 ) ) . field as * const _
                as usize } , 0usize , concat ! (
                "Alignment of field: " , stringify ! ( s__bindgen_ty_1 ) ,
                "::" , stringify ! ( field ) ));
}
impl Clone for s__bindgen_ty_1 {
    fn clone(&self) -> Self { *self }
}
#[test]
fn bindgen_test_layout_s() {
    assert_eq!(::std::mem::size_of::<s>() , 4usize , concat ! (
               "Size of: " , stringify ! ( s ) ));
    assert_eq! (::std::mem::align_of::<s>() , 4usize , concat ! (
                "Alignment of " , stringify ! ( s ) ));
    assert_eq! (unsafe { & ( * ( 0 as * const s ) ) . u as * const _ as usize
                } , 0usize , concat ! (
                "Alignment of field: " , stringify ! ( s ) , "::" , stringify
                ! ( u ) ));
}
impl Clone for s {
    fn clone(&self) -> Self { *self }
}
@emilio
Copy link
Contributor

emilio commented Feb 18, 2017

Thanks for the report, looking into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants