diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2019-01-04 00:04:00 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-01-04 00:04:00 +0100 |
commit | a73718cee2eb3887f88f5645cab14f6936fcb095 (patch) | |
tree | a517dbf69a8f00fb94e404051a4942384bb480d9 /src/codegen/mod.rs | |
parent | 651605fb8eb8683165f56d1dd53413573cf24ba3 (diff) | |
parent | 4eaca743b257ae51f5f80aa279a8faaefc98ffac (diff) |
Merge pull request #1483 from LegNeato/repr_transparent
Bitfield enums use #[repr(transparent)] on Rust 1.28+
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r-- | src/codegen/mod.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs index 898df167..6fd7e7d3 100644 --- a/src/codegen/mod.rs +++ b/src/codegen/mod.rs @@ -2573,7 +2573,11 @@ impl CodeGenerator for Enum { if variation.is_rust() { attrs.push(attributes::repr(repr_name)); } else if variation.is_bitfield() { - attrs.push(attributes::repr("C")); + if ctx.options().rust_features.repr_transparent { + attrs.push(attributes::repr("transparent")); + } else { + attrs.push(attributes::repr("C")); + } } if let Some(comment) = item.comment(ctx) { |