File tree 2 files changed +4
-8
lines changed
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 {
52
52
pub fn walk_feature_fields( & self , mut f: impl FnMut ( & str , bool ) ) {
53
53
$( f( stringify!( $feature) , self . $feature) ; ) +
54
54
}
55
- }
56
-
57
- impl std:: ops:: Index <Symbol > for Features {
58
- type Output = bool ;
59
55
60
- fn index ( & self , feature: Symbol ) -> & Self :: Output {
56
+ pub fn enabled ( & self , feature: Symbol ) -> bool {
61
57
match feature {
62
- $( sym:: $feature => & self . $feature, ) *
58
+ $( sym:: $feature => self . $feature, ) *
63
59
64
60
_ => panic!( "`{}` was not listed in `declare_features`" , feature) ,
65
61
}
Original file line number Diff line number Diff line change @@ -137,7 +137,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
137
137
let gates = expr. required_feature_gates ( ) ;
138
138
match gates {
139
139
// 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 ,
141
141
142
142
// `-Zunleash-the-miri-inside-of-you` only works for expressions that don't have a
143
143
// corresponding feature gate. This encourages nightly users to use feature gates when
@@ -158,7 +158,7 @@ impl<'tcx> CheckConstVisitor<'tcx> {
158
158
let missing_gates: Vec < _ > = gates
159
159
. iter ( )
160
160
. copied ( )
161
- . filter ( |& g| !features[ g ] )
161
+ . filter ( |& g| !features. enabled ( g ) )
162
162
. collect ( ) ;
163
163
164
164
match missing_gates. as_slice ( ) {
You can’t perform that action at this time.
0 commit comments