summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2016-10-23 11:28:22 -0500
committerGitHub <noreply@github.com>2016-10-23 11:28:22 -0500
commit9b227c81c7e92f612910fa0492346c0ef35a44a0 (patch)
tree59afb209c99cd059cd1def50a67c43ffaf554ab9
parentf49919239c6bbb81ebea2b47aa292a708527026b (diff)
parent55e7d0514bf635667adfb938d2e17cd1de6531bb (diff)
Auto merge of #110 - heycam:stable-gen-names, r=emilio
Give vtables and anonymous items more stable generated names (fixes #60) r? @emilio This works pretty well. There are two remaining things in stylo's structs files that have identifiers that look like they won't be that stable: the anonymous enum for the NODE_* flags at the top level, and the `typedef union { ... } nsStyleUnion`. There are various anonymous enums and other things at the top level in system headers that cause these identifiers to have generated IDs in them higher than 1 and 2. Probably for anonymous enums we could just avoid generating a rust enum altogether, since having the static consts should be sufficient. I tried to mess with the codegen to automatically treat `typedef union { ... } nsStyleUnion` like `union nsStyleUnion { ... }` but it seems the way clang exposes the typedef and union are as two adjacent cursors rather than a parent-child relationship, so it's not so easy.
-rw-r--r--Cargo.toml1
-rw-r--r--src/codegen/mod.rs4
-rw-r--r--src/ir/item.rs82
-rwxr-xr-xsrc/lib.rs2
-rw-r--r--tests/expectations/anon_enum.rs5
-rw-r--r--tests/expectations/anon_enum_whitelist.rs8
-rw-r--r--tests/expectations/anon_union.rs4
-rw-r--r--tests/expectations/class_with_inner_struct.rs67
-rw-r--r--tests/expectations/const_enum_unnamed.rs13
-rw-r--r--tests/expectations/enum_and_vtable_mangling.rs11
-rw-r--r--tests/expectations/jsval_layout_opaque.rs49
-rw-r--r--tests/expectations/namespace.rs6
-rw-r--r--tests/expectations/nested_vtable.rs4
-rw-r--r--tests/expectations/ref_argument_array.rs4
-rw-r--r--tests/expectations/struct_with_anon_struct.rs14
-rw-r--r--tests/expectations/struct_with_anon_struct_array.rs28
-rw-r--r--tests/expectations/struct_with_anon_struct_pointer.rs14
-rw-r--r--tests/expectations/struct_with_anon_union.rs14
-rw-r--r--tests/expectations/struct_with_anon_unnamed_struct.rs14
-rw-r--r--tests/expectations/struct_with_anon_unnamed_union.rs14
-rw-r--r--tests/expectations/struct_with_nesting.rs42
-rw-r--r--tests/expectations/struct_with_struct.rs14
-rw-r--r--tests/expectations/typeref.rs4
-rw-r--r--tests/expectations/union_fields.rs12
-rw-r--r--tests/expectations/union_template.rs8
-rw-r--r--tests/expectations/union_with_anon_struct.rs14
-rw-r--r--tests/expectations/union_with_anon_struct_bitfield.rs16
-rw-r--r--tests/expectations/union_with_anon_union.rs14
-rw-r--r--tests/expectations/union_with_anon_unnamed_struct.rs14
-rw-r--r--tests/expectations/union_with_anon_unnamed_union.rs14
-rw-r--r--tests/expectations/union_with_nesting.rs42
-rw-r--r--tests/expectations/unknown_attr.rs6
-rw-r--r--tests/expectations/virtual_dtor.rs4
-rw-r--r--tests/expectations/virtual_overloaded.rs4
-rw-r--r--tests/expectations/vtable_recursive_sig.rs4
35 files changed, 282 insertions, 288 deletions
diff --git a/Cargo.toml b/Cargo.toml
index cd32574b..dbbaf4a7 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,7 @@ quasi_codegen = "0.20"
[dependencies]
clang-sys = "0.8.0"
+lazy_static = "0.1.*"
libc = "0.2"
log = "0.3"
env_logger = "0.3"
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 17789e19..65900739 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -445,8 +445,8 @@ impl<'a> CodeGenerator for Vtable<'a> {
}
impl<'a> ItemCanonicalName for Vtable<'a> {
- fn canonical_name(&self, _ctx: &BindgenContext) -> String {
- format!("bindgen_vtable_{}", self.item_id)
+ fn canonical_name(&self, ctx: &BindgenContext) -> String {
+ format!("{}__bindgen_vtable", self.item_id.canonical_name(ctx))
}
}
diff --git a/src/ir/item.rs b/src/ir/item.rs
index 18f912c1..6cb6d7c6 100644
--- a/src/ir/item.rs
+++ b/src/ir/item.rs
@@ -1,10 +1,11 @@
+use regex::Regex;
use super::context::BindgenContext;
use super::item_kind::ItemKind;
use super::ty::{Type, TypeKind};
use super::function::Function;
use super::module::Module;
use super::annotations::Annotations;
-use std::fmt;
+use std::cell::Cell;
use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering};
use parse::{ClangItemParser, ClangSubItemParser, ParseError, ParseResult};
use clang;
@@ -46,13 +47,6 @@ pub trait ItemCanonicalPath {
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct ItemId(usize);
-impl fmt::Display for ItemId {
- fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
- try!(write!(fmt, "_bindgen_id_"));
- self.0.fmt(fmt)
- }
-}
-
pub static NEXT_ITEM_ID: AtomicUsize = ATOMIC_USIZE_INIT;
impl ItemId {
@@ -96,6 +90,11 @@ impl ItemCanonicalPath for ItemId {
pub struct Item {
/// This item's id.
id: ItemId,
+ /// The item's local id, unique only amongst its siblings. Only used
+ /// for anonymous items. Lazily initialized in local_id().
+ local_id: Cell<Option<usize>>,
+ /// The next local id to use for a child.
+ next_child_local_id: Cell<usize>,
/// A doc comment over the item, if any.
comment: Option<String>,
/// Annotations extracted from the doc comment, or the default ones
@@ -120,6 +119,8 @@ impl Item {
debug_assert!(id != parent_id || kind.is_module());
Item {
id: id,
+ local_id: Cell::new(None),
+ next_child_local_id: Cell::new(1),
parent_id: parent_id,
comment: comment,
annotations: annotations.unwrap_or_default(),
@@ -147,6 +148,16 @@ impl Item {
&mut self.kind
}
+ pub fn local_id(&self, ctx: &BindgenContext) -> usize {
+ if self.local_id.get().is_none() {
+ let parent = ctx.resolve_item(self.parent_id);
+ let local_id = parent.next_child_local_id.get();
+ parent.next_child_local_id.set(local_id + 1);
+ self.local_id.set(Some(local_id));
+ }
+ self.local_id.get().unwrap()
+ }
+
/// Returns whether this item is a top-level item, from the point of view of
/// bindgen.
///
@@ -435,7 +446,6 @@ impl Item {
ty.name()
}
}.map(ToOwned::to_owned)
- .unwrap_or_else(|| format!("_bindgen_ty{}", self.id()))
}
ItemKind::Function(ref fun) => {
let mut base = fun.name().to_owned();
@@ -464,30 +474,68 @@ impl Item {
}
}
}
- base
+ Some(base)
}
ItemKind::Var(ref var) => {
- var.name().to_owned()
+ Some(var.name().to_owned())
}
ItemKind::Module(ref module) => {
module.name().map(ToOwned::to_owned)
- .unwrap_or_else(|| format!("_bindgen_mod{}", self.id()))
}
};
let parent = ctx.resolve_item(self.parent_id());
let parent_is_namespace = parent.is_module();
+
if self.is_toplevel(ctx) || (parent_is_namespace && count_namespaces) {
+ let base_name = self.make_exposed_name(None, base_name, ctx);
return ctx.rust_mangle(&base_name).into_owned();
}
// TODO: allow modification of the mangling functions, maybe even per
// item type?
- let parent = parent.canonical_name(ctx);
- if parent.is_empty() {
- base_name.to_owned()
- } else {
- format!("{}_{}", parent, base_name)
+ let parent_name = parent.canonical_name(ctx);
+ self.make_exposed_name(Some(parent_name), base_name, ctx)
+ }
+
+ fn exposed_id(&self, ctx: &BindgenContext) -> String {
+ // Only use local ids for enums, classes, structs and union types. All
+ // other items use their global id.
+ let ty_kind = self.kind().as_type().map(|t| t.kind());
+ if let Some(ty_kind) = ty_kind {
+ match *ty_kind {
+ TypeKind::Comp(..) |
+ TypeKind::Enum(..) => return self.local_id(ctx).to_string(),
+ _ => {}
+ }
+ }
+ format!("id_{}", self.id().0)
+ }
+
+ fn make_exposed_name(&self,
+ parent_name: Option<String>,
+ base_name: Option<String>,
+ ctx: &BindgenContext) -> String {
+ lazy_static! {
+ static ref RE_ENDS_WITH_BINDGEN_TY: Regex = Regex::new(r"_bindgen_ty(_\d+)+$").unwrap();
+ static ref RE_ENDS_WITH_BINDGEN_MOD: Regex = Regex::new(r"_bindgen_mod(_\d+)+$").unwrap();
+ }
+ let (re, kind) = match *self.kind() {
+ ItemKind::Module(..) => (&*RE_ENDS_WITH_BINDGEN_MOD, "mod"),
+ _ => (&*RE_ENDS_WITH_BINDGEN_TY, "ty"),
+ };
+ let parent_name = parent_name.and_then(|n| if n.is_empty() { None } else { Some(n) });
+ match (parent_name, base_name) {
+ (Some(parent), Some(base)) => format!("{}_{}", parent, base),
+ (Some(parent), None) => {
+ if re.is_match(parent.as_str()) {
+ format!("{}_{}", parent, self.exposed_id(ctx))
+ } else {
+ format!("{}__bindgen_{}_{}", parent, kind, self.exposed_id(ctx))
+ }
+ }
+ (None, Some(base)) => base,
+ (None, None) => format!("_bindgen_{}_{}", kind, self.exposed_id(ctx)),
}
}
diff --git a/src/lib.rs b/src/lib.rs
index b06b4b52..b3e29f33 100755
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -16,6 +16,8 @@ extern crate libc;
extern crate regex;
#[macro_use]
extern crate log;
+#[macro_use]
+extern crate lazy_static;
mod clangll;
mod clang;
diff --git a/tests/expectations/anon_enum.rs b/tests/expectations/anon_enum.rs
index 17212c12..075830e6 100644
--- a/tests/expectations/anon_enum.rs
+++ b/tests/expectations/anon_enum.rs
@@ -10,11 +10,10 @@ pub struct Test {
pub foo: ::std::os::raw::c_int,
pub bar: f32,
}
-pub const Test_T_NONE: Test__bindgen_ty_bindgen_id_6 =
- Test__bindgen_ty_bindgen_id_6::T_NONE;
+pub const Test_T_NONE: Test__bindgen_ty_1 = Test__bindgen_ty_1::T_NONE;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum Test__bindgen_ty_bindgen_id_6 { T_NONE = 0, }
+pub enum Test__bindgen_ty_1 { T_NONE = 0, }
#[test]
fn bindgen_test_layout_Test() {
assert_eq!(::std::mem::size_of::<Test>() , 8usize);
diff --git a/tests/expectations/anon_enum_whitelist.rs b/tests/expectations/anon_enum_whitelist.rs
index 62c1f1a5..b32396a0 100644
--- a/tests/expectations/anon_enum_whitelist.rs
+++ b/tests/expectations/anon_enum_whitelist.rs
@@ -4,10 +4,8 @@
#![allow(non_snake_case)]
-pub const NODE_FLAG_FOO: _bindgen_ty_bindgen_id_1 =
- _bindgen_ty_bindgen_id_1::NODE_FLAG_FOO;
-pub const NODE_FLAG_BAR: _bindgen_ty_bindgen_id_1 =
- _bindgen_ty_bindgen_id_1::NODE_FLAG_BAR;
+pub const NODE_FLAG_FOO: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_FOO;
+pub const NODE_FLAG_BAR: _bindgen_ty_1 = _bindgen_ty_1::NODE_FLAG_BAR;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum _bindgen_ty_bindgen_id_1 { NODE_FLAG_FOO = 0, NODE_FLAG_BAR = 1, }
+pub enum _bindgen_ty_1 { NODE_FLAG_FOO = 0, NODE_FLAG_BAR = 1, }
diff --git a/tests/expectations/anon_union.rs b/tests/expectations/anon_union.rs
index 731d1dd9..0b1da364 100644
--- a/tests/expectations/anon_union.rs
+++ b/tests/expectations/anon_union.rs
@@ -28,7 +28,7 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[derive(Debug, Copy, Clone)]
pub struct TErrorResult<T> {
pub mResult: ::std::os::raw::c_int,
- pub __bindgen_anon_1: TErrorResult__bindgen_ty_bindgen_id_10<T>,
+ pub __bindgen_anon_1: TErrorResult__bindgen_ty_1<T>,
pub mMightHaveUnreported: bool,
pub mUnionState: TErrorResult_UnionState,
pub _phantom_0: ::std::marker::PhantomData<T>,
@@ -52,7 +52,7 @@ pub struct TErrorResult_DOMExceptionInfo<T> {
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct TErrorResult__bindgen_ty_bindgen_id_10<T> {
+pub struct TErrorResult__bindgen_ty_1<T> {
pub mMessage: __BindgenUnionField<*mut TErrorResult_Message<T>>,
pub mDOMExceptionInfo: __BindgenUnionField<*mut TErrorResult_DOMExceptionInfo<T>>,
pub bindgen_union_field: u64,
diff --git a/tests/expectations/class_with_inner_struct.rs b/tests/expectations/class_with_inner_struct.rs
index 98c0505a..ca8eb73b 100644
--- a/tests/expectations/class_with_inner_struct.rs
+++ b/tests/expectations/class_with_inner_struct.rs
@@ -28,8 +28,8 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[derive(Debug, Copy)]
pub struct A {
pub c: ::std::os::raw::c_uint,
- pub named_union: A__bindgen_ty_bindgen_id_9,
- pub __bindgen_anon_1: A__bindgen_ty_bindgen_id_14,
+ pub named_union: A__bindgen_ty_1,
+ pub __bindgen_anon_1: A__bindgen_ty_2,
}
#[repr(C)]
#[derive(Debug, Copy)]
@@ -47,31 +47,30 @@ impl Clone for A_Segment {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct A__bindgen_ty_bindgen_id_9 {
+pub struct A__bindgen_ty_1 {
pub f: __BindgenUnionField<::std::os::raw::c_int>,
pub bindgen_union_field: u32,
}
#[test]
-fn bindgen_test_layout_A__bindgen_ty_bindgen_id_9() {
- assert_eq!(::std::mem::size_of::<A__bindgen_ty_bindgen_id_9>() , 4usize);
- assert_eq!(::std::mem::align_of::<A__bindgen_ty_bindgen_id_9>() , 4usize);
+fn bindgen_test_layout_A__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<A__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<A__bindgen_ty_1>() , 4usize);
}
-impl Clone for A__bindgen_ty_bindgen_id_9 {
+impl Clone for A__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct A__bindgen_ty_bindgen_id_14 {
+pub struct A__bindgen_ty_2 {
pub d: __BindgenUnionField<::std::os::raw::c_int>,
pub bindgen_union_field: u32,
}
#[test]
-fn bindgen_test_layout_A__bindgen_ty_bindgen_id_14() {
- assert_eq!(::std::mem::size_of::<A__bindgen_ty_bindgen_id_14>() , 4usize);
- assert_eq!(::std::mem::align_of::<A__bindgen_ty_bindgen_id_14>() ,
- 4usize);
+fn bindgen_test_layout_A__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<A__bindgen_ty_2>() , 4usize);
+ assert_eq!(::std::mem::align_of::<A__bindgen_ty_2>() , 4usize);
}
-impl Clone for A__bindgen_ty_bindgen_id_14 {
+impl Clone for A__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
#[test]
@@ -121,57 +120,51 @@ pub enum StepSyntax {
#[derive(Debug, Copy)]
pub struct C {
pub d: ::std::os::raw::c_uint,
- pub __bindgen_anon_1: C__bindgen_ty_bindgen_id_31,
+ pub __bindgen_anon_1: C__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct C__bindgen_ty_bindgen_id_31 {
- pub mFunc: __BindgenUnionField<C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_32>,
- pub __bindgen_anon_1: __BindgenUnionField<C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_43>,
+pub struct C__bindgen_ty_1 {
+ pub mFunc: __BindgenUnionField<C__bindgen_ty_1_1>,
+ pub __bindgen_anon_1: __BindgenUnionField<C__bindgen_ty_1_2>,
pub bindgen_union_field: [u32; 4usize],
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_32 {
+pub struct C__bindgen_ty_1_1 {
pub mX1: f32,
pub mY1: f32,
pub mX2: f32,
pub mY2: f32,
}
#[test]
-fn bindgen_test_layout_C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_32() {
- assert_eq!(::std::mem::size_of::<C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_32>()
- , 16usize);
- assert_eq!(::std::mem::align_of::<C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_32>()
- , 4usize);
+fn bindgen_test_layout_C__bindgen_ty_1_1() {
+ assert_eq!(::std::mem::size_of::<C__bindgen_ty_1_1>() , 16usize);
+ assert_eq!(::std::mem::align_of::<C__bindgen_ty_1_1>() , 4usize);
}
-impl Clone for C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_32 {
+impl Clone for C__bindgen_ty_1_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_43 {
+pub struct C__bindgen_ty_1_2 {
pub mStepSyntax: StepSyntax,
pub mSteps: ::std::os::raw::c_uint,
}
#[test]
-fn bindgen_test_layout_C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_43() {
- assert_eq!(::std::mem::size_of::<C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_43>()
- , 8usize);
- assert_eq!(::std::mem::align_of::<C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_43>()
- , 4usize);
+fn bindgen_test_layout_C__bindgen_ty_1_2() {
+ assert_eq!(::std::mem::size_of::<C__bindgen_ty_1_2>() , 8usize);
+ assert_eq!(::std::mem::align_of::<C__bindgen_ty_1_2>() , 4usize);
}
-impl Clone for C__bindgen_ty_bindgen_id_31__bindgen_ty_bindgen_id_43 {
+impl Clone for C__bindgen_ty_1_2 {
fn clone(&self) -> Self { *self }
}
#[test]
-fn bindgen_test_layout_C__bindgen_ty_bindgen_id_31() {
- assert_eq!(::std::mem::size_of::<C__bindgen_ty_bindgen_id_31>() ,
- 16usize);
- assert_eq!(::std::mem::align_of::<C__bindgen_ty_bindgen_id_31>() ,
- 4usize);
+fn bindgen_test_layout_C__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<C__bindgen_ty_1>() , 16usize);
+ assert_eq!(::std::mem::align_of::<C__bindgen_ty_1>() , 4usize);
}
-impl Clone for C__bindgen_ty_bindgen_id_31 {
+impl Clone for C__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
diff --git a/tests/expectations/const_enum_unnamed.rs b/tests/expectations/const_enum_unnamed.rs
index e16dc405..0bd3987a 100644
--- a/tests/expectations/const_enum_unnamed.rs
+++ b/tests/expectations/const_enum_unnamed.rs
@@ -4,23 +4,20 @@
#![allow(non_snake_case)]
-pub const FOO_BAR: _bindgen_ty_bindgen_id_1 =
- _bindgen_ty_bindgen_id_1::FOO_BAR;
-pub const FOO_BAZ: _bindgen_ty_bindgen_id_1 =
- _bindgen_ty_bindgen_id_1::FOO_BAZ;
+pub const FOO_BAR: _bindgen_ty_1 = _bindgen_ty_1::FOO_BAR;
+pub const FOO_BAZ: _bindgen_ty_1 = _bindgen_ty_1::FOO_BAZ;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum _bindgen_ty_bindgen_id_1 { FOO_BAR = 0, FOO_BAZ = 1, }
+pub enum _bindgen_ty_1 { FOO_BAR = 0, FOO_BAZ = 1, }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct Foo {
pub _address: u8,
}
-pub const Foo_FOO_BAR: Foo__bindgen_ty_bindgen_id_5 =
- Foo__bindgen_ty_bindgen_id_5::FOO_BAR;
+pub const Foo_FOO_BAR: Foo__bindgen_ty_1 = Foo__bindgen_ty_1::FOO_BAR;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum Foo__bindgen_ty_bindgen_id_5 { FOO_BAR = 10, }
+pub enum Foo__bindgen_ty_1 { FOO_BAR = 10, }
#[test]
fn bindgen_test_layout_Foo() {
assert_eq!(::std::mem::size_of::<Foo>() , 1usize);
diff --git a/tests/expectations/enum_and_vtable_mangling.rs b/tests/expectations/enum_and_vtable_mangling.rs
index 3c7d5370..a55c344e 100644
--- a/tests/expectations/enum_and_vtable_mangling.rs
+++ b/tests/expectations/enum_and_vtable_mangling.rs
@@ -4,19 +4,18 @@
#![allow(non_snake_case)]
-pub const match_: _bindgen_ty_bindgen_id_1 = _bindgen_ty_bindgen_id_1::match_;
-pub const whatever_else: _bindgen_ty_bindgen_id_1 =
- _bindgen_ty_bindgen_id_1::whatever_else;
+pub const match_: _bindgen_ty_1 = _bindgen_ty_1::match_;
+pub const whatever_else: _bindgen_ty_1 = _bindgen_ty_1::whatever_else;
#[repr(u32)]
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
-pub enum _bindgen_ty_bindgen_id_1 { match_ = 0, whatever_else = 1, }
+pub enum _bindgen_ty_1 { match_ = 0, whatever_else = 1, }
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_4 {
+pub struct C__bindgen_vtable {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct C {
- pub vtable_: *const bindgen_vtable__bindgen_id_4,
+ pub vtable_: *const C__bindgen_vtable,
pub i: ::std::os::raw::c_int,
}
#[test]
diff --git a/tests/expectations/jsval_layout_opaque.rs b/tests/expectations/jsval_layout_opaque.rs
index dc0ecad5..f3c1014e 100644
--- a/tests/expectations/jsval_layout_opaque.rs
+++ b/tests/expectations/jsval_layout_opaque.rs
@@ -94,8 +94,8 @@ pub enum JSWhyMagic {
#[derive(Debug, Copy)]
pub struct jsval_layout {
pub asBits: __BindgenUnionField<u64>,
- pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_90>,
- pub s: __BindgenUnionField<jsval_layout__bindgen_ty_bindgen_id_97>,
+ pub debugView: __BindgenUnionField<jsval_layout__bindgen_ty_1>,
+ pub s: __BindgenUnionField<jsval_layout__bindgen_ty_2>,
pub asDouble: __BindgenUnionField<f64>,
pub asPtr: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub asWord: __BindgenUnionField<usize>,
@@ -104,20 +104,18 @@ pub struct jsval_layout {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_90 {
+pub struct jsval_layout__bindgen_ty_1 {
pub _bitfield_1: u64,
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_90() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_90>()
- , 8usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_90>()
- , 8usize);
+fn bindgen_test_layout_jsval_layout__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_1>() , 8usize);
}
-impl Clone for jsval_layout__bindgen_ty_bindgen_id_90 {
+impl Clone for jsval_layout__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl jsval_layout__bindgen_ty_bindgen_id_90 {
+impl jsval_layout__bindgen_ty_1 {
#[inline]
pub fn payload47(&self) -> u64 {
unsafe {
@@ -150,36 +148,33 @@ impl jsval_layout__bindgen_ty_bindgen_id_90 {
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_97 {
- pub payload: jsval_layout__bindgen_ty_bindgen_id_97__bindgen_ty_bindgen_id_98,
+pub struct jsval_layout__bindgen_ty_2 {
+ pub payload: jsval_layout__bindgen_ty_2_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct jsval_layout__bindgen_ty_bindgen_id_97__bindgen_ty_bindgen_id_98 {
+pub struct jsval_layout__bindgen_ty_2_1 {
pub i32: __BindgenUnionField<i32>,
pub u32: __BindgenUnionField<u32>,
pub why: __BindgenUnionField<JSWhyMagic>,
pub bindgen_union_field: u32,
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_97__bindgen_ty_bindgen_id_98() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_97__bindgen_ty_bindgen_id_98>()
- , 4usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_97__bindgen_ty_bindgen_id_98>()
- , 4usize);
-}
-impl Clone for
- jsval_layout__bindgen_ty_bindgen_id_97__bindgen_ty_bindgen_id_98 {
+fn bindgen_test_layout_jsval_layout__bindgen_ty_2_1() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2_1>() ,
+ 4usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_2_1>() ,
+ 4usize);
+}
+impl Clone for jsval_layout__bindgen_ty_2_1 {
fn clone(&self) -> Self { *self }
}
#[test]
-fn bindgen_test_layout_jsval_layout__bindgen_ty_bindgen_id_97() {
- assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_bindgen_id_97>()
- , 4usize);
- assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_bindgen_id_97>()
- , 4usize);
+fn bindgen_test_layout_jsval_layout__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<jsval_layout__bindgen_ty_2>() , 4usize);
+ assert_eq!(::std::mem::align_of::<jsval_layout__bindgen_ty_2>() , 4usize);
}
-impl Clone for jsval_layout__bindgen_ty_bindgen_id_97 {
+impl Clone for jsval_layout__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
impl Clone for jsval_layout {
diff --git a/tests/expectations/namespace.rs b/tests/expectations/namespace.rs
index ed0ca603..bc8bae68 100644
--- a/tests/expectations/namespace.rs
+++ b/tests/expectations/namespace.rs
@@ -18,7 +18,7 @@ pub mod root {
pub fn in_whatever();
}
}
- pub mod _bindgen_mod_bindgen_id_13 {
+ pub mod _bindgen_mod_id_13 {
use root;
pub mod empty {
use root;
@@ -44,7 +44,7 @@ pub mod root {
#[repr(C)]
#[derive(Debug)]
pub struct C<T> {
- pub _base: root::_bindgen_mod_bindgen_id_13::A,
+ pub _base: root::_bindgen_mod_id_13::A,
pub m_c: T,
pub m_c_ptr: *mut T,
pub m_c_arr: [T; 10usize],
@@ -78,7 +78,7 @@ extern "C" {
#[repr(C)]
#[derive(Debug)]
pub struct C<T> {
- pub _base: root::_bindgen_mod_bindgen_id_13::A,
+ pub _base: root::_bindgen_mod_id_13::A,
pub m_c: T,
pub m_c_ptr: *mut T,
pub m_c_arr: [T; 10usize],
diff --git a/tests/expectations/nested_vtable.rs b/tests/expectations/nested_vtable.rs
index 0c4f7dbe..d74ad55f 100644
--- a/tests/expectations/nested_vtable.rs
+++ b/tests/expectations/nested_vtable.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_1 {
+pub struct nsISupports__bindgen_vtable {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsISupports {
- pub vtable_: *const bindgen_vtable__bindgen_id_1,
+ pub vtable_: *const nsISupports__bindgen_vtable,
}
#[test]
fn bindgen_test_layout_nsISupports() {
diff --git a/tests/expectations/ref_argument_array.rs b/tests/expectations/ref_argument_array.rs
index 5cfac9d8..c88492d7 100644
--- a/tests/expectations/ref_argument_array.rs
+++ b/tests/expectations/ref_argument_array.rs
@@ -6,12 +6,12 @@
pub const NSID_LENGTH: ::std::os::raw::c_uint = 10;
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_4 {
+pub struct nsID__bindgen_vtable {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct nsID {
- pub vtable_: *const bindgen_vtable__bindgen_id_4,
+ pub vtable_: *const nsID__bindgen_vtable,
}
#[test]
fn bindgen_test_layout_nsID() {
diff --git a/tests/expectations/struct_with_anon_struct.rs b/tests/expectations/struct_with_anon_struct.rs
index e28c4fc0..1c49675d 100644
--- a/tests/expectations/struct_with_anon_struct.rs
+++ b/tests/expectations/struct_with_anon_struct.rs
@@ -7,22 +7,20 @@
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub bar: foo__bindgen_ty_bindgen_id_2,
+ pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 8usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/struct_with_anon_struct_array.rs b/tests/expectations/struct_with_anon_struct_array.rs
index c87605de..6e1c0315 100644
--- a/tests/expectations/struct_with_anon_struct_array.rs
+++ b/tests/expectations/struct_with_anon_struct_array.rs
@@ -7,39 +7,35 @@
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub bar: [foo__bindgen_ty_bindgen_id_2; 2usize],
- pub baz: [[[foo__bindgen_ty_bindgen_id_8; 4usize]; 3usize]; 2usize],
+ pub bar: [foo__bindgen_ty_1; 2usize],
+ pub baz: [[[foo__bindgen_ty_2; 4usize]; 3usize]; 2usize],
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 8usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_8 {
+pub struct foo__bindgen_ty_2 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_8() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_8>() ,
- 8usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_8>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_2() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_2>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_2>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_8 {
+impl Clone for foo__bindgen_ty_2 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/struct_with_anon_struct_pointer.rs b/tests/expectations/struct_with_anon_struct_pointer.rs
index a4b693a7..aa77d4b6 100644
--- a/tests/expectations/struct_with_anon_struct_pointer.rs
+++ b/tests/expectations/struct_with_anon_struct_pointer.rs
@@ -7,22 +7,20 @@
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub bar: *mut foo__bindgen_ty_bindgen_id_2,
+ pub bar: *mut foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_int,
pub b: ::std::os::raw::c_int,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 8usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/struct_with_anon_union.rs b/tests/expectations/struct_with_anon_union.rs
index 889bccf7..7c4a7d82 100644
--- a/tests/expectations/struct_with_anon_union.rs
+++ b/tests/expectations/struct_with_anon_union.rs
@@ -27,23 +27,21 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub bar: foo__bindgen_ty_bindgen_id_2,
+ pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u32,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/struct_with_anon_unnamed_struct.rs b/tests/expectations/struct_with_anon_unnamed_struct.rs
index ca590b1b..1b77fccc 100644
--- a/tests/expectations/struct_with_anon_unnamed_struct.rs
+++ b/tests/expectations/struct_with_anon_unnamed_struct.rs
@@ -7,22 +7,20 @@
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub __bindgen_anon_1: foo__bindgen_ty_bindgen_id_2,
+ pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_uint,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 8usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/struct_with_anon_unnamed_union.rs b/tests/expectations/struct_with_anon_unnamed_union.rs
index 013a9184..0763f590 100644
--- a/tests/expectations/struct_with_anon_unnamed_union.rs
+++ b/tests/expectations/struct_with_anon_unnamed_union.rs
@@ -27,23 +27,21 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub __bindgen_anon_1: foo__bindgen_ty_bindgen_id_2,
+ pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u32,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/struct_with_nesting.rs b/tests/expectations/struct_with_nesting.rs
index 9eeeb56e..0aacb6b3 100644
--- a/tests/expectations/struct_with_nesting.rs
+++ b/tests/expectations/struct_with_nesting.rs
@@ -28,58 +28,52 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[derive(Debug, Copy)]
pub struct foo {
pub a: ::std::os::raw::c_uint,
- pub __bindgen_anon_1: foo__bindgen_ty_bindgen_id_4,
+ pub __bindgen_anon_1: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_4 {
+pub struct foo__bindgen_ty_1 {
pub b: __BindgenUnionField<::std::os::raw::c_uint>,
- pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_7>,
- pub __bindgen_anon_2: __BindgenUnionField<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_12>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1_1>,
+ pub __bindgen_anon_2: __BindgenUnionField<foo__bindgen_ty_1_2>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_7 {
+pub struct foo__bindgen_ty_1_1 {
pub c1: ::std::os::raw::c_ushort,
pub c2: ::std::os::raw::c_ushort,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_7() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_7>()
- , 4usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_7>()
- , 2usize);
+fn bindgen_test_layout_foo__bindgen_ty_1_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1_1>() , 2usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_7 {
+impl Clone for foo__bindgen_ty_1_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_12 {
+pub struct foo__bindgen_ty_1_2 {
pub d1: ::std::os::raw::c_uchar,
pub d2: ::std::os::raw::c_uchar,
pub d3: ::std::os::raw::c_uchar,
pub d4: ::std::os::raw::c_uchar,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_12() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_12>()
- , 4usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_12>()
- , 1usize);
+fn bindgen_test_layout_foo__bindgen_ty_1_2() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1_2>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1_2>() , 1usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_12 {
+impl Clone for foo__bindgen_ty_1_2 {
fn clone(&self) -> Self { *self }
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_4() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_4>() ,
- 4usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_4>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_4 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/struct_with_struct.rs b/tests/expectations/struct_with_struct.rs
index 27ff4795..c8cdc927 100644
--- a/tests/expectations/struct_with_struct.rs
+++ b/tests/expectations/struct_with_struct.rs
@@ -7,22 +7,20 @@
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub bar: foo__bindgen_ty_bindgen_id_2,
+ pub bar: foo__bindgen_ty_1,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub x: ::std::os::raw::c_uint,
pub y: ::std::os::raw::c_uint,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 8usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/typeref.rs b/tests/expectations/typeref.rs
index 50795077..a8fe14cd 100644
--- a/tests/expectations/typeref.rs
+++ b/tests/expectations/typeref.rs
@@ -79,12 +79,12 @@ impl Clone for Bar {
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct StyleShapeSource<ReferenceBox> {
- pub __bindgen_anon_1: StyleShapeSource__bindgen_ty_bindgen_id_14<ReferenceBox>,
+ pub __bindgen_anon_1: StyleShapeSource__bindgen_ty_1<ReferenceBox>,
pub _phantom_0: ::std::marker::PhantomData<ReferenceBox>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct StyleShapeSource__bindgen_ty_bindgen_id_14<ReferenceBox> {
+pub struct StyleShapeSource__bindgen_ty_1<ReferenceBox> {
pub mPosition: __BindgenUnionField<*mut Position>,
pub mFragmentOrURL: __BindgenUnionField<*mut FragmentOrURL>,
pub bindgen_union_field: u64,
diff --git a/tests/expectations/union_fields.rs b/tests/expectations/union_fields.rs
index 684a9e04..49bdca13 100644
--- a/tests/expectations/union_fields.rs
+++ b/tests/expectations/union_fields.rs
@@ -26,18 +26,18 @@ impl <T> ::std::clone::Clone for __BindgenUnionField<T> {
impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct _bindgen_ty_bindgen_id_1 {
+pub struct _bindgen_ty_1 {
pub mInt: __BindgenUnionField<::std::os::raw::c_int>,
pub mFloat: __BindgenUnionField<f32>,
pub mPointer: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub bindgen_union_field: u64,
}
#[test]
-fn bindgen_test_layout__bindgen_ty_bindgen_id_1() {
- assert_eq!(::std::mem::size_of::<_bindgen_ty_bindgen_id_1>() , 8usize);
- assert_eq!(::std::mem::align_of::<_bindgen_ty_bindgen_id_1>() , 8usize);
+fn bindgen_test_layout__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<_bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<_bindgen_ty_1>() , 8usize);
}
-impl Clone for _bindgen_ty_bindgen_id_1 {
+impl Clone for _bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-pub type nsStyleUnion = _bindgen_ty_bindgen_id_1;
+pub type nsStyleUnion = _bindgen_ty_1;
diff --git a/tests/expectations/union_template.rs b/tests/expectations/union_template.rs
index 1e3cf17e..0114e306 100644
--- a/tests/expectations/union_template.rs
+++ b/tests/expectations/union_template.rs
@@ -28,13 +28,13 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[derive(Debug, Copy, Clone)]
pub struct NastyStruct<T> {
pub mIsSome: bool,
- pub mStorage: NastyStruct__bindgen_ty_bindgen_id_6<T>,
- pub __bindgen_anon_1: NastyStruct__bindgen_ty_bindgen_id_12<T>,
+ pub mStorage: NastyStruct__bindgen_ty_1<T>,
+ pub __bindgen_anon_1: NastyStruct__bindgen_ty_2<T>,
pub _phantom_0: ::std::marker::PhantomData<T>,
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct NastyStruct__bindgen_ty_bindgen_id_6<T> {
+pub struct NastyStruct__bindgen_ty_1<T> {
pub mFoo: __BindgenUnionField<*mut ::std::os::raw::c_void>,
pub mDummy: __BindgenUnionField<::std::os::raw::c_ulong>,
pub bindgen_union_field: u64,
@@ -42,7 +42,7 @@ pub struct NastyStruct__bindgen_ty_bindgen_id_6<T> {
}
#[repr(C)]
#[derive(Debug, Copy, Clone)]
-pub struct NastyStruct__bindgen_ty_bindgen_id_12<T> {
+pub struct NastyStruct__bindgen_ty_2<T> {
pub wat: __BindgenUnionField<::std::os::raw::c_short>,
pub wut: __BindgenUnionField<*mut ::std::os::raw::c_int>,
pub bindgen_union_field: u64,
diff --git a/tests/expectations/union_with_anon_struct.rs b/tests/expectations/union_with_anon_struct.rs
index f216b0bf..406dd231 100644
--- a/tests/expectations/union_with_anon_struct.rs
+++ b/tests/expectations/union_with_anon_struct.rs
@@ -27,23 +27,21 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub bar: __BindgenUnionField<foo__bindgen_ty_bindgen_id_2>,
+ pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: [u32; 2usize],
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub a: ::std::os::raw::c_uint,
pub b: ::std::os::raw::c_uint,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 8usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 8usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/union_with_anon_struct_bitfield.rs b/tests/expectations/union_with_anon_struct_bitfield.rs
index 1332d92e..91d9fa59 100644
--- a/tests/expectations/union_with_anon_struct_bitfield.rs
+++ b/tests/expectations/union_with_anon_struct_bitfield.rs
@@ -28,25 +28,23 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[derive(Debug, Copy)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_int>,
- pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_bindgen_id_4>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_4 {
+pub struct foo__bindgen_ty_1 {
pub _bitfield_1: u32,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_4() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_4>() ,
- 4usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_4>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_4 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-impl foo__bindgen_ty_bindgen_id_4 {
+impl foo__bindgen_ty_1 {
#[inline]
pub fn b(&self) -> ::std::os::raw::c_int {
unsafe {
diff --git a/tests/expectations/union_with_anon_union.rs b/tests/expectations/union_with_anon_union.rs
index e7f43cbe..c7ca3411 100644
--- a/tests/expectations/union_with_anon_union.rs
+++ b/tests/expectations/union_with_anon_union.rs
@@ -27,24 +27,22 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[repr(C)]
#[derive(Debug, Copy)]
pub struct foo {
- pub bar: __BindgenUnionField<foo__bindgen_ty_bindgen_id_2>,
+ pub bar: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_2 {
+pub struct foo__bindgen_ty_1 {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u32,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_2() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_2>() ,
- 4usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 4usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_2 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/union_with_anon_unnamed_struct.rs b/tests/expectations/union_with_anon_unnamed_struct.rs
index defbe66b..33d75aff 100644
--- a/tests/expectations/union_with_anon_unnamed_struct.rs
+++ b/tests/expectations/union_with_anon_unnamed_struct.rs
@@ -28,25 +28,23 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[derive(Debug, Copy)]
pub struct pixel {
pub rgba: __BindgenUnionField<::std::os::raw::c_uint>,
- pub __bindgen_anon_1: __BindgenUnionField<pixel__bindgen_ty_bindgen_id_4>,
+ pub __bindgen_anon_1: __BindgenUnionField<pixel__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct pixel__bindgen_ty_bindgen_id_4 {
+pub struct pixel__bindgen_ty_1 {
pub r: ::std::os::raw::c_uchar,
pub g: ::std::os::raw::c_uchar,
pub b: ::std::os::raw::c_uchar,
pub a: ::std::os::raw::c_uchar,
}
#[test]
-fn bindgen_test_layout_pixel__bindgen_ty_bindgen_id_4() {
- assert_eq!(::std::mem::size_of::<pixel__bindgen_ty_bindgen_id_4>() ,
- 4usize);
- assert_eq!(::std::mem::align_of::<pixel__bindgen_ty_bindgen_id_4>() ,
- 1usize);
+fn bindgen_test_layout_pixel__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<pixel__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<pixel__bindgen_ty_1>() , 1usize);
}
-impl Clone for pixel__bindgen_ty_bindgen_id_4 {
+impl Clone for pixel__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/union_with_anon_unnamed_union.rs b/tests/expectations/union_with_anon_unnamed_union.rs
index 519bf619..c47850f5 100644
--- a/tests/expectations/union_with_anon_unnamed_union.rs
+++ b/tests/expectations/union_with_anon_unnamed_union.rs
@@ -28,24 +28,22 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[derive(Debug, Copy)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
- pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_bindgen_id_4>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_4 {
+pub struct foo__bindgen_ty_1 {
pub b: __BindgenUnionField<::std::os::raw::c_ushort>,
pub c: __BindgenUnionField<::std::os::raw::c_uchar>,
pub bindgen_union_field: u16,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_4() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_4>() ,
- 2usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_4>() ,
- 2usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 2usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_4 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/union_with_nesting.rs b/tests/expectations/union_with_nesting.rs
index d7fc780a..6ed81adb 100644
--- a/tests/expectations/union_with_nesting.rs
+++ b/tests/expectations/union_with_nesting.rs
@@ -28,57 +28,51 @@ impl <T> ::std::marker::Copy for __BindgenUnionField<T> { }
#[derive(Debug, Copy)]
pub struct foo {
pub a: __BindgenUnionField<::std::os::raw::c_uint>,
- pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_bindgen_id_4>,
+ pub __bindgen_anon_1: __BindgenUnionField<foo__bindgen_ty_1>,
pub bindgen_union_field: u32,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_4 {
- pub __bindgen_anon_1: foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_5,
- pub __bindgen_anon_2: foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_10,
+pub struct foo__bindgen_ty_1 {
+ pub __bindgen_anon_1: foo__bindgen_ty_1_1,
+ pub __bindgen_anon_2: foo__bindgen_ty_1_2,
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_5 {
+pub struct foo__bindgen_ty_1_1 {
pub b1: __BindgenUnionField<::std::os::raw::c_ushort>,
pub b2: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u16,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_5() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_5>()
- , 2usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_5>()
- , 2usize);
+fn bindgen_test_layout_foo__bindgen_ty_1_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1_1>() , 2usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1_1>() , 2usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_5 {
+impl Clone for foo__bindgen_ty_1_1 {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_10 {
+pub struct foo__bindgen_ty_1_2 {
pub c1: __BindgenUnionField<::std::os::raw::c_ushort>,
pub c2: __BindgenUnionField<::std::os::raw::c_ushort>,
pub bindgen_union_field: u16,
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_10() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_10>()
- , 2usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_10>()
- , 2usize);
+fn bindgen_test_layout_foo__bindgen_ty_1_2() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1_2>() , 2usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1_2>() , 2usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_4__bindgen_ty_bindgen_id_10 {
+impl Clone for foo__bindgen_ty_1_2 {
fn clone(&self) -> Self { *self }
}
#[test]
-fn bindgen_test_layout_foo__bindgen_ty_bindgen_id_4() {
- assert_eq!(::std::mem::size_of::<foo__bindgen_ty_bindgen_id_4>() ,
- 4usize);
- assert_eq!(::std::mem::align_of::<foo__bindgen_ty_bindgen_id_4>() ,
- 2usize);
+fn bindgen_test_layout_foo__bindgen_ty_1() {
+ assert_eq!(::std::mem::size_of::<foo__bindgen_ty_1>() , 4usize);
+ assert_eq!(::std::mem::align_of::<foo__bindgen_ty_1>() , 2usize);
}
-impl Clone for foo__bindgen_ty_bindgen_id_4 {
+impl Clone for foo__bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
#[test]
diff --git a/tests/expectations/unknown_attr.rs b/tests/expectations/unknown_attr.rs
index 06da6a3c..fd9cce45 100644
--- a/tests/expectations/unknown_attr.rs
+++ b/tests/expectations/unknown_attr.rs
@@ -6,11 +6,11 @@
#[repr(C)]
#[derive(Debug, Copy)]
-pub struct _bindgen_ty_bindgen_id_1 {
+pub struct _bindgen_ty_1 {
pub __clang_max_align_nonce1: ::std::os::raw::c_longlong,
pub __clang_max_align_nonce2: f64,
}
-impl Clone for _bindgen_ty_bindgen_id_1 {
+impl Clone for _bindgen_ty_1 {
fn clone(&self) -> Self { *self }
}
-pub type max_align_t = _bindgen_ty_bindgen_id_1;
+pub type max_align_t = _bindgen_ty_1;
diff --git a/tests/expectations/virtual_dtor.rs b/tests/expectations/virtual_dtor.rs
index 99e0a535..9571f084 100644
--- a/tests/expectations/virtual_dtor.rs
+++ b/tests/expectations/virtual_dtor.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_1 {
+pub struct nsSlots__bindgen_vtable {
}
#[repr(C)]
#[derive(Debug)]
pub struct nsSlots {
- pub vtable_: *const bindgen_vtable__bindgen_id_1,
+ pub vtable_: *const nsSlots__bindgen_vtable,
}
#[test]
fn bindgen_test_layout_nsSlots() {
diff --git a/tests/expectations/virtual_overloaded.rs b/tests/expectations/virtual_overloaded.rs
index d395fed0..7833cdbf 100644
--- a/tests/expectations/virtual_overloaded.rs
+++ b/tests/expectations/virtual_overloaded.rs
@@ -5,12 +5,12 @@
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_1 {
+pub struct C__bindgen_vtable {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct C {
- pub vtable_: *const bindgen_vtable__bindgen_id_1,
+ pub vtable_: *const C__bindgen_vtable,
}
#[test]
fn bindgen_test_layout_C() {
diff --git a/tests/expectations/vtable_recursive_sig.rs b/tests/expectations/vtable_recursive_sig.rs
index 1044c4e4..ce62eeb0 100644
--- a/tests/expectations/vtable_recursive_sig.rs
+++ b/tests/expectations/vtable_recursive_sig.rs
@@ -18,12 +18,12 @@ impl Clone for Derived {
fn clone(&self) -> Self { *self }
}
#[repr(C)]
-pub struct bindgen_vtable__bindgen_id_2 {
+pub struct Base__bindgen_vtable {
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct Base {
- pub vtable_: *const bindgen_vtable__bindgen_id_2,
+ pub vtable_: *const Base__bindgen_vtable,
}
#[test]
fn bindgen_test_layout_Base() {