Skip to content

Commit b2c478f

Browse files
committed
Add rust target configuration for feature #1554
Will panic if the feature is being used outside nightly. See #1575 (comment)
1 parent ac78e07 commit b2c478f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/codegen/mod.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2580,8 +2580,10 @@ impl CodeGenerator for Enum {
25802580
match variation {
25812581
EnumVariation::Rust { non_exhaustive: nh } => {
25822582
attrs.push(attributes::repr(repr_name));
2583-
if nh {
2583+
if nh && ctx.options().rust_features().non_exhaustive {
25842584
attrs.push(attributes::non_exhaustive());
2585+
} else if nh && !ctx.options().rust_features().non_exhaustive {
2586+
panic!("The rust target you're using doesn't seem to support non_exhaustive enums");
25852587
}
25862588
},
25872589
EnumVariation::Bitfield => {

src/features.rs

+2
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,8 @@ rust_feature_def!(
206206
Nightly {
207207
/// `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202))
208208
=> thiscall_abi;
209+
/// `non_exhaustive` enums/structs ([Tracking issue](https://github.com/rust-lang/rust/issues/44109))
210+
=> non_exhaustive;
209211
}
210212
);
211213

0 commit comments

Comments
 (0)