summaryrefslogtreecommitdiff
path: root/src/codegen/mod.rs
diff options
context:
space:
mode:
authoruk <50893351+unterkontrolle@users.noreply.github.com>2019-06-11 11:49:48 -0300
committeruk <50893351+unterkontrolle@users.noreply.github.com>2019-06-11 11:49:48 -0300
commitb2c478f9ccb971f350e364d16a45cdd128dca3a8 (patch)
tree6787766df27f953caced6adac55ceea090843037 /src/codegen/mod.rs
parentac78e077c70586d66d19aee21ecececc16cb90f8 (diff)
Add rust target configuration for feature #1554
Will panic if the feature is being used outside nightly. See https://github.com/rust-lang/rust-bindgen/pull/1575#discussion_r292231027
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 => {