1
Fork 0

nightly feature tracking: get rid of the per-feature bool fields

This commit is contained in:
Ralf Jung 2024-10-09 09:01:57 +02:00
parent e1f3068995
commit ad3991d303
108 changed files with 299 additions and 331 deletions

View file

@ -137,7 +137,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
let inner = attr.meta_item_list();
match inner.as_deref() {
Some([item]) if item.has_name(sym::linker) => {
if !tcx.features().used_with_arg {
if !tcx.features().used_with_arg() {
feature_err(
&tcx.sess,
sym::used_with_arg,
@ -149,7 +149,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
codegen_fn_attrs.flags |= CodegenFnAttrFlags::USED_LINKER;
}
Some([item]) if item.has_name(sym::compiler) => {
if !tcx.features().used_with_arg {
if !tcx.features().used_with_arg() {
feature_err(
&tcx.sess,
sym::used_with_arg,
@ -213,7 +213,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
.emit();
}
if is_closure
&& !tcx.features().closure_track_caller
&& !tcx.features().closure_track_caller()
&& !attr.span.allows_unstable(sym::closure_track_caller)
{
feature_err(
@ -268,7 +268,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
//
// This exception needs to be kept in sync with allowing
// `#[target_feature]` on `main` and `start`.
} else if !tcx.features().target_feature_11 {
} else if !tcx.features().target_feature_11() {
feature_err(
&tcx.sess,
sym::target_feature_11,
@ -584,7 +584,7 @@ fn codegen_fn_attrs(tcx: TyCtxt<'_>, did: LocalDefId) -> CodegenFnAttrs {
// its parent function, which effectively inherits the features anyway. Boxing this closure
// would result in this closure being compiled without the inherited target features, but this
// is probably a poor usage of `#[inline(always)]` and easily avoided by not using the attribute.
if tcx.features().target_feature_11
if tcx.features().target_feature_11()
&& tcx.is_closure_like(did.to_def_id())
&& codegen_fn_attrs.inline != InlineAttr::Always
{

View file

@ -63,27 +63,27 @@ pub(crate) fn from_target_feature(
// Only allow features whose feature gates have been enabled.
let allowed = match feature_gate.as_ref().copied() {
Some(sym::arm_target_feature) => rust_features.arm_target_feature,
Some(sym::hexagon_target_feature) => rust_features.hexagon_target_feature,
Some(sym::powerpc_target_feature) => rust_features.powerpc_target_feature,
Some(sym::mips_target_feature) => rust_features.mips_target_feature,
Some(sym::riscv_target_feature) => rust_features.riscv_target_feature,
Some(sym::avx512_target_feature) => rust_features.avx512_target_feature,
Some(sym::sse4a_target_feature) => rust_features.sse4a_target_feature,
Some(sym::tbm_target_feature) => rust_features.tbm_target_feature,
Some(sym::wasm_target_feature) => rust_features.wasm_target_feature,
Some(sym::rtm_target_feature) => rust_features.rtm_target_feature,
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature,
Some(sym::bpf_target_feature) => rust_features.bpf_target_feature,
Some(sym::aarch64_ver_target_feature) => rust_features.aarch64_ver_target_feature,
Some(sym::csky_target_feature) => rust_features.csky_target_feature,
Some(sym::loongarch_target_feature) => rust_features.loongarch_target_feature,
Some(sym::lahfsahf_target_feature) => rust_features.lahfsahf_target_feature,
Some(sym::prfchw_target_feature) => rust_features.prfchw_target_feature,
Some(sym::sha512_sm_x86) => rust_features.sha512_sm_x86,
Some(sym::x86_amx_intrinsics) => rust_features.x86_amx_intrinsics,
Some(sym::xop_target_feature) => rust_features.xop_target_feature,
Some(sym::s390x_target_feature) => rust_features.s390x_target_feature,
Some(sym::arm_target_feature) => rust_features.arm_target_feature(),
Some(sym::hexagon_target_feature) => rust_features.hexagon_target_feature(),
Some(sym::powerpc_target_feature) => rust_features.powerpc_target_feature(),
Some(sym::mips_target_feature) => rust_features.mips_target_feature(),
Some(sym::riscv_target_feature) => rust_features.riscv_target_feature(),
Some(sym::avx512_target_feature) => rust_features.avx512_target_feature(),
Some(sym::sse4a_target_feature) => rust_features.sse4a_target_feature(),
Some(sym::tbm_target_feature) => rust_features.tbm_target_feature(),
Some(sym::wasm_target_feature) => rust_features.wasm_target_feature(),
Some(sym::rtm_target_feature) => rust_features.rtm_target_feature(),
Some(sym::ermsb_target_feature) => rust_features.ermsb_target_feature(),
Some(sym::bpf_target_feature) => rust_features.bpf_target_feature(),
Some(sym::aarch64_ver_target_feature) => rust_features.aarch64_ver_target_feature(),
Some(sym::csky_target_feature) => rust_features.csky_target_feature(),
Some(sym::loongarch_target_feature) => rust_features.loongarch_target_feature(),
Some(sym::lahfsahf_target_feature) => rust_features.lahfsahf_target_feature(),
Some(sym::prfchw_target_feature) => rust_features.prfchw_target_feature(),
Some(sym::sha512_sm_x86) => rust_features.sha512_sm_x86(),
Some(sym::x86_amx_intrinsics) => rust_features.x86_amx_intrinsics(),
Some(sym::xop_target_feature) => rust_features.xop_target_feature(),
Some(sym::s390x_target_feature) => rust_features.s390x_target_feature(),
Some(name) => bug!("unknown target feature gate {}", name),
None => true,
};