summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/codegen/mod.rs')
-rw-r--r--src/codegen/mod.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/codegen/mod.rs b/src/codegen/mod.rs
index aa920c9b..2863387f 100644
--- a/src/codegen/mod.rs
+++ b/src/codegen/mod.rs
@@ -2580,8 +2580,10 @@ impl CodeGenerator for Enum {
match variation {
EnumVariation::Rust { non_exhaustive: nh } => {
attrs.push(attributes::repr(repr_name));
- if nh {
+ if nh && ctx.options().rust_features().non_exhaustive {
attrs.push(attributes::non_exhaustive());
+ } else if nh && !ctx.options().rust_features().non_exhaustive {
+ panic!("The rust target you're using doesn't seem to support non_exhaustive enums");
}
},
EnumVariation::Bitfield => {