Skip to content

Commit 7340b9c

Browse files
committed
rustc_feature: remove no-longer-needed macro
1 parent ad3991d commit 7340b9c

File tree

1 file changed

+22
-24
lines changed

1 file changed

+22
-24
lines changed

compiler/rustc_feature/src/builtin_attrs.rs

+22-24
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,31 @@ use crate::{Features, Stability};
1212

1313
type GateFn = fn(&Features) -> bool;
1414

15-
macro_rules! cfg_fn {
16-
($field: ident) => {
17-
Features::$field as GateFn
18-
};
19-
}
20-
2115
pub type GatedCfg = (Symbol, Symbol, GateFn);
2216

2317
/// `cfg(...)`'s that are feature gated.
2418
const GATED_CFGS: &[GatedCfg] = &[
2519
// (name in cfg, feature, function to check if the feature is enabled)
26-
(sym::overflow_checks, sym::cfg_overflow_checks, cfg_fn!(cfg_overflow_checks)),
27-
(sym::ub_checks, sym::cfg_ub_checks, cfg_fn!(cfg_ub_checks)),
28-
(sym::target_thread_local, sym::cfg_target_thread_local, cfg_fn!(cfg_target_thread_local)),
20+
(sym::overflow_checks, sym::cfg_overflow_checks, Features::cfg_overflow_checks),
21+
(sym::ub_checks, sym::cfg_ub_checks, Features::cfg_ub_checks),
22+
(sym::target_thread_local, sym::cfg_target_thread_local, Features::cfg_target_thread_local),
2923
(
3024
sym::target_has_atomic_equal_alignment,
3125
sym::cfg_target_has_atomic_equal_alignment,
32-
cfg_fn!(cfg_target_has_atomic_equal_alignment),
33-
),
34-
(sym::target_has_atomic_load_store, sym::cfg_target_has_atomic, cfg_fn!(cfg_target_has_atomic)),
35-
(sym::sanitize, sym::cfg_sanitize, cfg_fn!(cfg_sanitize)),
36-
(sym::version, sym::cfg_version, cfg_fn!(cfg_version)),
37-
(sym::relocation_model, sym::cfg_relocation_model, cfg_fn!(cfg_relocation_model)),
38-
(sym::sanitizer_cfi_generalize_pointers, sym::cfg_sanitizer_cfi, cfg_fn!(cfg_sanitizer_cfi)),
39-
(sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, cfg_fn!(cfg_sanitizer_cfi)),
26+
Features::cfg_target_has_atomic_equal_alignment,
27+
),
28+
(
29+
sym::target_has_atomic_load_store,
30+
sym::cfg_target_has_atomic,
31+
Features::cfg_target_has_atomic,
32+
),
33+
(sym::sanitize, sym::cfg_sanitize, Features::cfg_sanitize),
34+
(sym::version, sym::cfg_version, Features::cfg_version),
35+
(sym::relocation_model, sym::cfg_relocation_model, Features::cfg_relocation_model),
36+
(sym::sanitizer_cfi_generalize_pointers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
37+
(sym::sanitizer_cfi_normalize_integers, sym::cfg_sanitizer_cfi, Features::cfg_sanitizer_cfi),
4038
// this is consistent with naming of the compiler flag it's for
41-
(sym::fmt_debug, sym::fmt_debug, cfg_fn!(fmt_debug)),
39+
(sym::fmt_debug, sym::fmt_debug, Features::fmt_debug),
4240
];
4341

4442
/// Find a gated cfg determined by the `pred`icate which is given the cfg's name.
@@ -220,7 +218,7 @@ macro_rules! gated {
220218
safety: AttributeSafety::Unsafe,
221219
template: $tpl,
222220
duplicates: $duplicates,
223-
gate: Gated(Stability::Unstable, sym::$gate, $msg, cfg_fn!($gate)),
221+
gate: Gated(Stability::Unstable, sym::$gate, $msg, Features::$gate),
224222
}
225223
};
226224
(unsafe $attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr, $msg:expr $(,)?) => {
@@ -231,7 +229,7 @@ macro_rules! gated {
231229
safety: AttributeSafety::Unsafe,
232230
template: $tpl,
233231
duplicates: $duplicates,
234-
gate: Gated(Stability::Unstable, sym::$attr, $msg, cfg_fn!($attr)),
232+
gate: Gated(Stability::Unstable, sym::$attr, $msg, Features::$attr),
235233
}
236234
};
237235
($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr, $gate:ident, $msg:expr $(,)?) => {
@@ -242,7 +240,7 @@ macro_rules! gated {
242240
safety: AttributeSafety::Normal,
243241
template: $tpl,
244242
duplicates: $duplicates,
245-
gate: Gated(Stability::Unstable, sym::$gate, $msg, cfg_fn!($gate)),
243+
gate: Gated(Stability::Unstable, sym::$gate, $msg, Features::$gate),
246244
}
247245
};
248246
($attr:ident, $typ:expr, $tpl:expr, $duplicates:expr, $encode_cross_crate:expr, $msg:expr $(,)?) => {
@@ -253,7 +251,7 @@ macro_rules! gated {
253251
safety: AttributeSafety::Normal,
254252
template: $tpl,
255253
duplicates: $duplicates,
256-
gate: Gated(Stability::Unstable, sym::$attr, $msg, cfg_fn!($attr)),
254+
gate: Gated(Stability::Unstable, sym::$attr, $msg, Features::$attr),
257255
}
258256
};
259257
}
@@ -282,7 +280,7 @@ macro_rules! rustc_attr {
282280
safety: AttributeSafety::Normal,
283281
template: $tpl,
284282
duplicates: $duplicates,
285-
gate: Gated(Stability::Unstable, sym::rustc_attrs, $msg, cfg_fn!(rustc_attrs)),
283+
gate: Gated(Stability::Unstable, sym::rustc_attrs, $msg, Features::rustc_attrs),
286284
}
287285
};
288286
}
@@ -935,7 +933,7 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
935933
Stability::Unstable,
936934
sym::rustc_attrs,
937935
"diagnostic items compiler internal support for linting",
938-
cfg_fn!(rustc_attrs),
936+
Features::rustc_attrs,
939937
),
940938
},
941939
gated!(

0 commit comments

Comments
 (0)