summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-01-22 03:27:58 -0600
committerGitHub <noreply@github.com>2018-01-22 03:27:58 -0600
commita2409da1f7fae5ca3654d79d66216f2770832f52 (patch)
tree58aa716a127d75f6e00ec2c1fe24df04d80b3ce8 /src/codegen/mod.rs
parent8fa15cc9b93bffdb93ac05c374eca25157bcf281 (diff)
parenta79b404c9dc08aed6dbe7bf07c20647666e9f65d (diff)
Auto merge of #1232 - emilio:enum-colon-bool, r=pepyakin
codegen: Try to reasonably handle enum : bool. Just use the repr name we generate, since we generate constants for that. It's not worth trying to guess the actual type to use IMO. Bindings lose a bit of portability I guess, but that's really a lost bet already, so instead of special-casing bool and map constants, let's use a consistent representation everywhere. Fixes #1145
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index 5641b84d..43a2ec09 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2486,13 +2486,10 @@ impl CodeGenerator for Enum {
});
}
- let repr =
- self.repr()
- .and_then(|repr| repr.try_to_rust_ty_or_opaque(ctx, &()).ok())
- .unwrap_or_else(|| {
- let repr_name = ctx.rust_ident_raw(repr_name);
- quote! { #repr_name }
- });
+ let repr = {
+ let repr_name = ctx.rust_ident_raw(repr_name);
+ quote! { #repr_name }
+ };
let mut builder = EnumBuilder::new(
&name,