@@ -5,7 +5,6 @@ use rustc_data_structures::unord::{UnordMap, UnordSet};
5
5
use rustc_errors:: Applicability ;
6
6
use rustc_hir:: def:: DefKind ;
7
7
use rustc_hir:: def_id:: { DefId , LOCAL_CRATE , LocalDefId } ;
8
- use rustc_middle:: bug;
9
8
use rustc_middle:: middle:: codegen_fn_attrs:: TargetFeature ;
10
9
use rustc_middle:: query:: Providers ;
11
10
use rustc_middle:: ty:: TyCtxt ;
@@ -61,30 +60,9 @@ pub(crate) fn from_target_feature(
61
60
return None ;
62
61
} ;
63
62
64
- // Only allow features whose feature gates have been enabled.
63
+ // Only allow target features whose feature gates have been enabled.
65
64
let allowed = match feature_gate. as_ref ( ) . copied ( ) {
66
- Some ( sym:: arm_target_feature) => rust_features. arm_target_feature ( ) ,
67
- Some ( sym:: hexagon_target_feature) => rust_features. hexagon_target_feature ( ) ,
68
- Some ( sym:: powerpc_target_feature) => rust_features. powerpc_target_feature ( ) ,
69
- Some ( sym:: mips_target_feature) => rust_features. mips_target_feature ( ) ,
70
- Some ( sym:: riscv_target_feature) => rust_features. riscv_target_feature ( ) ,
71
- Some ( sym:: avx512_target_feature) => rust_features. avx512_target_feature ( ) ,
72
- Some ( sym:: sse4a_target_feature) => rust_features. sse4a_target_feature ( ) ,
73
- Some ( sym:: tbm_target_feature) => rust_features. tbm_target_feature ( ) ,
74
- Some ( sym:: wasm_target_feature) => rust_features. wasm_target_feature ( ) ,
75
- Some ( sym:: rtm_target_feature) => rust_features. rtm_target_feature ( ) ,
76
- Some ( sym:: ermsb_target_feature) => rust_features. ermsb_target_feature ( ) ,
77
- Some ( sym:: bpf_target_feature) => rust_features. bpf_target_feature ( ) ,
78
- Some ( sym:: aarch64_ver_target_feature) => rust_features. aarch64_ver_target_feature ( ) ,
79
- Some ( sym:: csky_target_feature) => rust_features. csky_target_feature ( ) ,
80
- Some ( sym:: loongarch_target_feature) => rust_features. loongarch_target_feature ( ) ,
81
- Some ( sym:: lahfsahf_target_feature) => rust_features. lahfsahf_target_feature ( ) ,
82
- Some ( sym:: prfchw_target_feature) => rust_features. prfchw_target_feature ( ) ,
83
- Some ( sym:: sha512_sm_x86) => rust_features. sha512_sm_x86 ( ) ,
84
- Some ( sym:: x86_amx_intrinsics) => rust_features. x86_amx_intrinsics ( ) ,
85
- Some ( sym:: xop_target_feature) => rust_features. xop_target_feature ( ) ,
86
- Some ( sym:: s390x_target_feature) => rust_features. s390x_target_feature ( ) ,
87
- Some ( name) => bug ! ( "unknown target feature gate {}" , name) ,
65
+ Some ( name) => rust_features. enabled ( name) ,
88
66
None => true ,
89
67
} ;
90
68
if !allowed {
0 commit comments