File tree 2 files changed +5
-1
lines changed
2 files changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -2580,8 +2580,10 @@ impl CodeGenerator for Enum {
2580
2580
match variation {
2581
2581
EnumVariation :: Rust { non_exhaustive : nh } => {
2582
2582
attrs. push ( attributes:: repr ( repr_name) ) ;
2583
- if nh {
2583
+ if nh && ctx . options ( ) . rust_features ( ) . non_exhaustive {
2584
2584
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" ) ;
2585
2587
}
2586
2588
} ,
2587
2589
EnumVariation :: Bitfield => {
Original file line number Diff line number Diff line change @@ -206,6 +206,8 @@ rust_feature_def!(
206
206
Nightly {
207
207
/// `thiscall` calling convention ([Tracking issue](https://github.com/rust-lang/rust/issues/42202))
208
208
=> thiscall_abi;
209
+ /// `non_exhaustive` enums/structs ([Tracking issue](https://github.com/rust-lang/rust/issues/44109))
210
+ => non_exhaustive;
209
211
}
210
212
) ;
211
213
You can’t perform that action at this time.
0 commit comments