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

Rust error: type parameter is unused #820

Closed
upsuper opened this issue Jul 18, 2017 · 6 comments
Closed

Rust error: type parameter is unused #820

upsuper opened this issue Jul 18, 2017 · 6 comments

Comments

@upsuper
Copy link
Contributor

upsuper commented Jul 18, 2017

Input C/C++ Header

template<typename E, int N>
class Foo {
  typedef Foo<E, N> self_type;
  E mBar;
};

Bindgen Invocation

$ bindgen input.hpp

Actual Results

pub type Foo_self_type<E> = u8;

which is not valid in Rust.

Expected Results

Probably it doesn't need to generate anything in this case.

RUST_LOG=bindgen Output

INFO:bindgen: Clang Version: clang version 4.0.0 (tags/RELEASE_400/final)
WARN:bindgen: Using clang (4, 0), expected (3, 9)
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: {} }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }, declaration: None, loc: None
DEBUG:bindgen::ir::item: Item::from_ty_with_id: ItemId(1)
	ty = Type(, kind: Invalid, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)),
	location = Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(, kind: Invalid, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Some(Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), None
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(, kind: Invalid, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Some(Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), None
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::ty: from_clang_ty: ItemId(1), ty: Type(, kind: Invalid, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), loc: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))
DEBUG:bindgen::ir::ty: currently_parsed_types: [PartialType { decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), id: ItemId(1) }]
WARN:bindgen::ir::comp: Unknown kind for comp type: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)
DEBUG:bindgen::ir::comp: CompInfo::from_ty(Struct, Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")))
DEBUG:bindgen::ir::item: Item::named_type:
	with_id = None,
	ty = E Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)),
	location: Cursor(E kind: TemplateTypeParameter, loc: test.hpp:1:19, usr: Some("c:test.hpp@9"))
DEBUG:bindgen::ir::context: BindgenContext::add_named_type: 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(0), kind: Type(Type { name: Some("E"), layout: None, kind: Named, is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }; definition = Cursor(E kind: TemplateTypeParameter, loc: test.hpp:1:19, usr: Some("c:test.hpp@9"))
DEBUG:bindgen::ir::context: add_item_to_module: adding ItemId(2) as child of parent module ItemId(0)
DEBUG:bindgen::ir::item: Item::from_ty_with_id: ItemId(3)
	ty = Type(self_type, kind: Typedef, cconv: 100, decl: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), canon: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))),
	location = Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(self_type, kind: Typedef, cconv: 100, decl: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), canon: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))), Some(Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(self_type, kind: Typedef, cconv: 100, decl: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), canon: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))), Some(Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::ty: from_clang_ty: ItemId(3), ty: Type(self_type, kind: Typedef, cconv: 100, decl: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), canon: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))), loc: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))
DEBUG:bindgen::ir::ty: currently_parsed_types: [PartialType { decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), id: ItemId(1) }, PartialType { decl: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), id: ItemId(3) }]
DEBUG:bindgen::ir::item: from_ty_or_ref_with_id: ItemId(4) Type(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), None
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), Some(Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))), None
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::item: New unresolved type reference: Type(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))
DEBUG:bindgen::ir::context: BindgenContext::add_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(0), kind: Type(Type { name: None, layout: None, kind: UnresolvedTypeRef(Type(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), None), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }, declaration: Some(Cursor( kind: InvalidFile, loc: builtin definitions, usr: None)), loc: None
DEBUG:bindgen::ir::context: add_item_to_module: adding ItemId(4) as child of parent module ItemId(0)
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(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), None), is_const: false }
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(1), kind: Type(Type { name: Some("self_type"), layout: None, kind: Alias(ItemId(4)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }, declaration: Some(Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))), loc: Some(Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")))
DEBUG:bindgen::ir::context: add_item_to_module: adding ItemId(3) as child of current module ItemId(0)
DEBUG:bindgen::ir::item: from_ty_or_ref_with_id: ItemId(5) Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar")), Some(ItemId(1))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Some(Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::item: New unresolved type reference: Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar"))
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(1), kind: Type(Type { name: None, layout: None, kind: UnresolvedTypeRef(Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar")), Some(ItemId(1))), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }, declaration: Some(Cursor( kind: InvalidFile, loc: builtin definitions, usr: None)), loc: None
DEBUG:bindgen::ir::context: add_item_to_module: adding ItemId(5) as child of current module ItemId(0)
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(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar")), Some(ItemId(1))), is_const: false }
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("Foo"), layout: None, kind: Comp(CompInfo { kind: Struct, fields: BeforeComputingBitfieldUnits([RawField(FieldData { name: Some("mBar"), ty: ItemId(5), 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: None })]), template_params: [ItemId(2)], methods: [], constructors: [], destructor: None, base_members: [], inner_types: [ItemId(3)], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: true, 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 }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }, declaration: Some(Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), loc: Some(Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")))
DEBUG:bindgen::ir::context: add_item_to_module: adding ItemId(1) as child of parent module ItemId(0)
DEBUG:bindgen::ir::item: Item::from_ty_with_id: ItemId(6)
	ty = Type(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))),
	location = Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))
DEBUG:bindgen::ir::item: Item::named_type:
	with_id = Some(ItemId(6)),
	ty = self_type Type(self_type, kind: Typedef, cconv: 100, decl: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")), canon: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))),
	location: Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), Some(Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type"))), None
DEBUG:bindgen::ir::context: Already resolved ty ItemId(1), CanonicalTypeDeclaration(Type(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))), Type(Foo<E, N>, kind: Unexposed, cconv: 100, decl: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo")), canon: Cursor(Foo kind: ClassTemplate, loc: test.hpp:2:7, usr: Some("c:@ST>2#T#NI@Foo"))) Some(Cursor(self_type kind: TypedefDecl, loc: test.hpp:3:21, usr: Some("c:test.hpp@ST>2#T#NI@Foo@T@self_type")))
WARN:bindgen::ir::context: Found template arg cursor we can't handle: Cursor(N kind: DeclRefExpr, loc: test.hpp:3:18, usr: None)
DEBUG:bindgen::ir::item: from_ty_or_ref_with_id: ItemId(7) Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Cursor(E kind: TypeRef, loc: test.hpp:3:15, usr: None), Some(ItemId(1))
DEBUG:bindgen::ir::item: refs already collected, resolving directly
DEBUG:bindgen::ir::item: Item::from_ty_with_id: ItemId(7)
	ty = Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)),
	location = Cursor(E kind: TypeRef, loc: test.hpp:3:15, usr: None)
DEBUG:bindgen::ir::item: Item::named_type:
	with_id = Some(ItemId(7)),
	ty = E Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)),
	location: Cursor(E kind: TypeRef, loc: test.hpp:3:15, usr: None)
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("E"), layout: None, kind: ResolvedTypeRef(ItemId(2)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::ir::context: add_item_to_module: adding ItemId(7) as child of parent module ItemId(0)
WARN:bindgen::ir::context: Found template instantiated with a const value; bindgen can't handle this kind of template instantiation!
DEBUG:bindgen::ir::item: Item::from_ty_with_id: ItemId(8)
	ty = Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)),
	location = Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar"))
DEBUG:bindgen::ir::item: Item::named_type:
	with_id = Some(ItemId(8)),
	ty = E Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)),
	location: Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar"))
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Some(Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::context: builtin_or_resolved_ty: Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), Some(Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar"))), Some(ItemId(1))
DEBUG:bindgen::ir::context: Not resolved, maybe builtin?
DEBUG:bindgen::ir::ty: from_clang_ty: ItemId(8), ty: Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), loc: Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar"))
DEBUG:bindgen::ir::ty: currently_parsed_types: []
WARN:bindgen::ir::ty: Unexposed type Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)), recursing inside, loc: Cursor(mBar kind: FieldDecl, loc: test.hpp:4:5, usr: Some("c:@ST>2#T#NI@Foo@FI@mBar"))
DEBUG:bindgen::ir::item: Item::from_ty recursing in the ast
DEBUG:bindgen::ir::item: Item::from_ty_with_id: ItemId(8)
	ty = Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)),
	location = Cursor(E kind: TypeRef, loc: test.hpp:4:3, usr: None)
DEBUG:bindgen::ir::item: Item::named_type:
	with_id = Some(ItemId(8)),
	ty = E Type(E, kind: Unexposed, cconv: 100, decl: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None), canon: Cursor( kind: NoDeclFound, loc: builtin definitions, usr: None)),
	location: Cursor(E kind: TypeRef, loc: test.hpp:4:3, usr: None)
DEBUG:bindgen::ir::context: add_builtin_item: item = Item { id: ItemId(8), 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("E"), layout: None, kind: ResolvedTypeRef(ItemId(2)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::ir::context: add_item_to_module: adding ItemId(8) as child of parent module ItemId(0)
DEBUG:bindgen::ir::context: No replacements to process
TRACE:bindgen::ir::named: constrain ItemId(2)
TRACE:bindgen::ir::named:   initially, used set is {}
TRACE:bindgen::ir::named:     named type, trivially uses itself
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: enqueue ItemId(1) into worklist
TRACE:bindgen::ir::named: enqueue ItemId(7) into worklist
TRACE:bindgen::ir::named: enqueue ItemId(8) into worklist
TRACE:bindgen::ir::named: constrain ItemId(8)
TRACE:bindgen::ir::named:   initially, used set is {}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(2)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: enqueue ItemId(5) into worklist
TRACE:bindgen::ir::named: constrain ItemId(5)
TRACE:bindgen::ir::named:   initially, used set is {}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(8)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: enqueue ItemId(1) into worklist
TRACE:bindgen::ir::named: constrain ItemId(1)
TRACE:bindgen::ir::named:   initially, used set is {}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(5)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: enqueue ItemId(4) into worklist
TRACE:bindgen::ir::named: constrain ItemId(4)
TRACE:bindgen::ir::named:   initially, used set is {}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(1)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: enqueue ItemId(3) into worklist
TRACE:bindgen::ir::named: constrain ItemId(3)
TRACE:bindgen::ir::named:   initially, used set is {}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(4)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: enqueue ItemId(1) into worklist
TRACE:bindgen::ir::named: constrain ItemId(1)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(5)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(7)
TRACE:bindgen::ir::named:   initially, used set is {}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(2)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(1)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(5)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(8)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(2)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(2)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     named type, trivially uses itself
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(7)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(2)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(8)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(2)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(5)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(8)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(1)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(5)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(4)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(1)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(4)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(1)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(3)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(4)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(2)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     named type, trivially uses itself
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(5)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(8)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(3)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(4)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(2)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     named type, trivially uses itself
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(1)
TRACE:bindgen::ir::named:   initially, used set is {ItemId(2)}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:       union with ItemId(5)'s usage: [ItemId(2)]
TRACE:bindgen::ir::named:   finally, used set is {ItemId(2)}
TRACE:bindgen::ir::named: constrain ItemId(0)
TRACE:bindgen::ir::named:   initially, used set is {}
TRACE:bindgen::ir::named:     other item: join with successors' usage
TRACE:bindgen::ir::named:   finally, used set is {}
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([])) }, constified_enum_modules: RegexSet { items: [], set: Some(RegexSet([])) }, builtins: false, links: [], emit_ast: false, emit_ir: false, emit_ir_graphviz: None, enable_cxx_namespaces: false, disable_name_namespacing: false, layout_tests: true, derive_debug: true, derive_default: false, unstable_rust: false, 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", "/usr/local/include", "-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", "/usr/include", "-isystem", "/System/Library/Frameworks", "-isystem", "/Library/Frameworks", "test.hpp"], input_header: Some("test.hpp"), input_unsaved_files: [], dummy_uses: None, parse_callbacks: None, codegen_config: CodegenConfig { functions: true, types: true, vars: true, methods: true, constructors: true, destructors: true }, conservative_inline_namespaces: false, generate_comments: true, generate_inline_functions: false, whitelist_recursively: true, objc_extern_crate: false, enable_mangling: true, prepend_enum_name: true }
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: {ItemId(1), ItemId(2), ItemId(3), ItemId(4), ItemId(5), ItemId(7), ItemId(8)} }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
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: {ItemId(1), ItemId(2), ItemId(3), ItemId(4), ItemId(5), ItemId(7), ItemId(8)} }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = 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("Foo"), layout: None, kind: Comp(CompInfo { kind: Struct, fields: AfterComputingBitfieldUnits([DataMember(FieldData { name: Some("mBar"), ty: ItemId(5), 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: None })]), template_params: [ItemId(2)], methods: [], constructors: [], destructor: None, base_members: [], inner_types: [ItemId(3)], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: true, 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 }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: 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("Foo"), layout: None, kind: Comp(CompInfo { kind: Struct, fields: AfterComputingBitfieldUnits([DataMember(FieldData { name: Some("mBar"), ty: ItemId(5), 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: None })]), template_params: [ItemId(2)], methods: [], constructors: [], destructor: None, base_members: [], inner_types: [ItemId(3)], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: true, 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 }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <CompInfo as CodeGenerator>::codegen: 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("Foo"), layout: None, kind: Comp(CompInfo { kind: Struct, fields: AfterComputingBitfieldUnits([DataMember(FieldData { name: Some("mBar"), ty: ItemId(5), 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: None })]), template_params: [ItemId(2)], methods: [], constructors: [], destructor: None, base_members: [], inner_types: [ItemId(3)], inner_vars: [], has_vtable: false, has_destructor: false, has_nonempty_base: false, has_non_type_template_params: true, 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 }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = 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(0), kind: Type(Type { name: Some("E"), layout: None, kind: Named, is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: 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(0), kind: Type(Type { name: Some("E"), layout: None, kind: Named, is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = 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(1), kind: Type(Type { name: Some("self_type"), layout: None, kind: Alias(ItemId(4)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: 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(1), kind: Type(Type { name: Some("self_type"), layout: None, kind: Alias(ItemId(4)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = Item { id: ItemId(4), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: Some("Foo") }, 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: None, layout: None, kind: ResolvedTypeRef(ItemId(1)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: item = Item { id: ItemId(4), local_id: Cell { value: None }, next_child_local_id: Cell { value: 1 }, canonical_name_cache: RefCell { value: Some("Foo") }, 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: None, layout: None, kind: ResolvedTypeRef(ItemId(1)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = 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(1), kind: Type(Type { name: None, layout: None, kind: ResolvedTypeRef(ItemId(8)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: 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(1), kind: Type(Type { name: None, layout: None, kind: ResolvedTypeRef(ItemId(8)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = 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("E"), layout: None, kind: ResolvedTypeRef(ItemId(2)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: 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("E"), layout: None, kind: ResolvedTypeRef(ItemId(2)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Item as CodeGenerator>::codegen: self = Item { id: ItemId(8), 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("E"), layout: None, kind: ResolvedTypeRef(ItemId(2)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
DEBUG:bindgen::codegen: <Type as CodeGenerator>::codegen: item = Item { id: ItemId(8), 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("E"), layout: None, kind: ResolvedTypeRef(ItemId(2)), is_const: false }), detect_derive_debug_cycle: Cell { value: false }, detect_derive_copy_cycle: Cell { value: false } }
@upsuper
Copy link
Contributor Author

upsuper commented Jul 18, 2017

This is probably workaround-able via blacklisting any involving type, but that would be annoying.

@fitzgen
Copy link
Member

fitzgen commented Jul 18, 2017

I'm C-Reducing this right now :-P

Nice to have you beat me to it :)

@fitzgen
Copy link
Member

fitzgen commented Jul 18, 2017

ir

@fitzgen
Copy link
Member

fitzgen commented Jul 18, 2017

It looks like we aren't following this if's consequent properly, inside the codegen for aliases:

                let mut used_template_params = item.used_template_params(ctx);
                let inner_rust_type = if item.is_opaque(ctx, &()) {
                    used_template_params = None;
                    self.to_opaque(ctx, item)
                } else {
                    // Its possible that we have better layout information than
                    // the inner type does, so fall back to an opaque blob based
                    // on our layout if converting the inner item fails.
                    inner_item.try_to_rust_ty_or_opaque(ctx, &())
                        .unwrap_or_else(|_| self.to_opaque(ctx, item))
                };

I would expect that teh has_nontype_template_params on the inner type would cause it to be opaque and then we would clear the used_template_params for the alias's definition.

@fitzgen fitzgen self-assigned this Jul 18, 2017
@fitzgen
Copy link
Member

fitzgen commented Jul 18, 2017

Oh, it turns out we're just plain missing that case from any of our IsOpaque implementations.

fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Jul 18, 2017
This allows us to properly detect structs that should be treated as opaque due
to their non-type template paramaters, which in turn lets us correctly codegen
template aliases to such things.

Fixes rust-lang#820
@fitzgen
Copy link
Member

fitzgen commented Jul 18, 2017

Hmmm... My fix is running afoul of our regression test for #372. Investigating.

fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Jul 18, 2017
This allows us to properly detect structs that should be treated as opaque due
to their non-type template paramaters, which in turn lets us correctly codegen
template aliases to such things.

Fixes rust-lang#820
fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Jul 18, 2017
This allows us to properly detect structs that should be treated as opaque due
to their non-type template paramaters, which in turn lets us correctly codegen
template aliases to such things.

Fixes rust-lang#820
fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Jul 18, 2017
This allows us to properly detect structs that should be treated as opaque due
to their non-type template paramaters, which in turn lets us correctly codegen
template aliases to such things.

Fixes rust-lang#820
fitzgen added a commit to fitzgen/rust-bindgen that referenced this issue Jul 20, 2017
This allows us to properly detect structs that should be treated as opaque due
to their non-type template paramaters, which in turn lets us correctly codegen
template aliases to such things.

Fixes rust-lang#820
bors-servo pushed a commit that referenced this issue Jul 20, 2017
…, r=emilio

Implement `IsOpaque` for `CompInfo`

This allows us to properly detect structs that should be treated as opaque due to their non-type template paramaters, which in turn lets us correctly codegen template aliases to such things.

Fixes #820

r? @emilio
tmfink pushed a commit to tmfink/rust-bindgen that referenced this issue Aug 4, 2017
This allows us to properly detect structs that should be treated as opaque due
to their non-type template paramaters, which in turn lets us correctly codegen
template aliases to such things.

Fixes rust-lang#820
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants