summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/codegen/mod.rs8
-rw-r--r--tests/expectations/tests/enum-default-consts.rs6
-rw-r--r--tests/expectations/tests/enum.rs6
-rw-r--r--tests/expectations/tests/enum_explicit_type_constants.rs4
-rw-r--r--tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs2
5 files changed, 11 insertions, 15 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index ffa6879b..99cdf3c8 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2625,7 +2625,6 @@ enum EnumBuilder<'a> {
is_bitfield: bool,
},
Consts {
- repr: proc_macro2::TokenStream,
variants: Vec<proc_macro2::TokenStream>,
codegen_depth: usize,
},
@@ -2696,7 +2695,6 @@ impl<'a> EnumBuilder<'a> {
});
EnumBuilder::Consts {
- repr,
variants,
codegen_depth: enum_codegen_depth,
}
@@ -2800,7 +2798,7 @@ impl<'a> EnumBuilder<'a> {
self
}
- EnumBuilder::Consts { ref repr, .. } => {
+ EnumBuilder::Consts { .. } => {
let constant_name = match mangling_prefix {
Some(prefix) => {
Cow::Owned(format!("{}_{}", prefix, variant_name))
@@ -2808,12 +2806,10 @@ impl<'a> EnumBuilder<'a> {
None => variant_name,
};
- let ty = if is_ty_named { &rust_ty } else { repr };
-
let ident = ctx.rust_ident(constant_name);
result.push(quote! {
#doc
- pub const #ident : #ty = #expr ;
+ pub const #ident : #rust_ty = #expr ;
});
self
diff --git a/tests/expectations/tests/enum-default-consts.rs b/tests/expectations/tests/enum-default-consts.rs
index 5c023a3c..d7f5d7c2 100644
--- a/tests/expectations/tests/enum-default-consts.rs
+++ b/tests/expectations/tests/enum-default-consts.rs
@@ -10,8 +10,8 @@
pub struct foo {
pub member: foo__bindgen_ty_1,
}
-pub const foo_FOO_A: ::std::os::raw::c_uint = 0;
-pub const foo_FOO_B: ::std::os::raw::c_uint = 1;
+pub const foo_FOO_A: foo__bindgen_ty_1 = 0;
+pub const foo_FOO_B: foo__bindgen_ty_1 = 1;
pub type foo__bindgen_ty_1 = ::std::os::raw::c_uint;
#[test]
fn bindgen_test_layout_foo() {
@@ -60,4 +60,4 @@ pub type NoDebug = ::std::os::raw::c_uint;
pub const Debug_Debug1: Debug = 0;
pub const Debug_Debug2: Debug = 1;
/// <div rustbindgen derive="Debug"></div>
-pub type Debug = ::std::os::raw::c_uint; \ No newline at end of file
+pub type Debug = ::std::os::raw::c_uint;
diff --git a/tests/expectations/tests/enum.rs b/tests/expectations/tests/enum.rs
index cc3f4932..fd76151f 100644
--- a/tests/expectations/tests/enum.rs
+++ b/tests/expectations/tests/enum.rs
@@ -10,8 +10,8 @@
pub struct foo {
pub member: foo__bindgen_ty_1,
}
-pub const foo_FOO_A: ::std::os::raw::c_uint = 0;
-pub const foo_FOO_B: ::std::os::raw::c_uint = 1;
+pub const foo_FOO_A: foo__bindgen_ty_1 = 0;
+pub const foo_FOO_B: foo__bindgen_ty_1 = 1;
pub type foo__bindgen_ty_1 = ::std::os::raw::c_uint;
#[test]
fn bindgen_test_layout_foo() {
@@ -58,4 +58,4 @@ pub type NoDebug = ::std::os::raw::c_uint;
pub const Debug_Debug1: Debug = 0;
pub const Debug_Debug2: Debug = 1;
/// <div rustbindgen derive="Debug"></div>
-pub type Debug = ::std::os::raw::c_uint; \ No newline at end of file
+pub type Debug = ::std::os::raw::c_uint;
diff --git a/tests/expectations/tests/enum_explicit_type_constants.rs b/tests/expectations/tests/enum_explicit_type_constants.rs
index 117f6847..0c833b66 100644
--- a/tests/expectations/tests/enum_explicit_type_constants.rs
+++ b/tests/expectations/tests/enum_explicit_type_constants.rs
@@ -26,6 +26,6 @@ pub type BoolEnumsAreFun = bool;
pub type MyType = bool;
pub const BoolEnumsAreFun2_Value2: BoolEnumsAreFun2 = true;
pub type BoolEnumsAreFun2 = MyType;
-pub const AnonymousVariantOne: ::std::os::raw::c_uchar = 0;
-pub const AnonymousVariantTwo: ::std::os::raw::c_uchar = 1;
+pub const AnonymousVariantOne: _bindgen_ty_1 = 0;
+pub const AnonymousVariantTwo: _bindgen_ty_1 = 1;
pub type _bindgen_ty_1 = ::std::os::raw::c_uchar;
diff --git a/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs b/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs
index e615486e..8ead5b8a 100644
--- a/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs
+++ b/tests/expectations/tests/parsecb-anonymous-enum-variant-rename.rs
@@ -5,5 +5,5 @@
non_upper_case_globals
)]
-pub const RENAMED_MyVal: ::std::os::raw::c_uint = 0;
+pub const RENAMED_MyVal: _bindgen_ty_1 = 0;
pub type _bindgen_ty_1 = ::std::os::raw::c_uint;