diff options
-rw-r--r-- | src/codegen/mod.rs | 4 | ||||
-rw-r--r-- | src/features.rs | 2 |
2 files changed, 5 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 => { diff --git a/src/features.rs b/src/features.rs index 05f5dc42..4dc526ec 100644 --- a/src/features.rs +++ b/src/features.rs @@ -206,6 +206,8 @@ rust_feature_def!( Nightly { /// `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202)) => thiscall_abi; + /// `non_exhaustive` enums/structs ([Tracking issue](https://github.com/rust-lang/rust/issues/44109)) + => non_exhaustive; } ); |