File tree Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Expand file tree Collapse file tree 2 files changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -52,14 +52,10 @@ macro_rules! declare_features {
5252 pub fn walk_feature_fields( & self , mut f: impl FnMut ( & str , bool ) ) {
5353 $( f( stringify!( $feature) , self . $feature) ; ) +
5454 }
55- }
56-
57- impl std:: ops:: Index <Symbol > for Features {
58- type Output = bool ;
5955
60- fn index ( & self , feature: Symbol ) -> & Self :: Output {
56+ pub fn enabled ( & self , feature: Symbol ) -> bool {
6157 match feature {
62- $( sym:: $feature => & self . $feature, ) *
58+ $( sym:: $feature => self . $feature, ) *
6359
6460 _ => panic!( "`{}` was not listed in `declare_features`" , feature) ,
6561 }
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
137137 let gates = expr. required_feature_gates ( ) ;
138138 match gates {
139139 // Don't emit an error if the user has enabled the requisite feature gates.
140- Some ( gates) if gates. iter ( ) . all ( |& g| features[ g ] ) => return ,
140+ Some ( gates) if gates. iter ( ) . all ( |& g| features. enabled ( g ) ) => return ,
141141
142142 // `-Zunleash-the-miri-inside-of-you` only works for expressions that don't have a
143143 // corresponding feature gate. This encourages nightly users to use feature gates when
@@ -158,7 +158,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
158158 let missing_gates: Vec < _ > = gates
159159 . iter ( )
160160 . copied ( )
161- . filter ( |& g| !features[ g ] )
161+ . filter ( |& g| !features. enabled ( g ) )
162162 . collect ( ) ;
163163
164164 match missing_gates. as_slice ( ) {
You can’t perform that action at this time.
0 commit comments