about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-08-27 17:07:02 +0200
committerRalf Jung <post@ralfj.de>2024-08-31 12:14:05 +0200
commitc2984179d91654162fac32c60be6f9cec5d655cd (patch)
tree6a831d54c7ee55b16f1faf7304d1dfa412e7bc01 /compiler/rustc_const_eval/src
parentbf662eb80838008acabc307dd64d84935ce3a20d (diff)
downloadrust-c2984179d91654162fac32c60be6f9cec5d655cd.tar.gz
rust-c2984179d91654162fac32c60be6f9cec5d655cd.zip
const fn stability checking: also check declared language features
Diffstat (limited to 'compiler/rustc_const_eval/src')
-rw-r--r--compiler/rustc_const_eval/src/check_consts/check.rs4
1 files changed, 1 insertions, 3 deletions
diff --git a/compiler/rustc_const_eval/src/check_consts/check.rs b/compiler/rustc_const_eval/src/check_consts/check.rs
index 6a086a3a7e5..7cfb101399d 100644
--- a/compiler/rustc_const_eval/src/check_consts/check.rs
+++ b/compiler/rustc_const_eval/src/check_consts/check.rs
@@ -868,9 +868,7 @@ impl<'tcx> Visitor<'tcx> for Checker<'_, 'tcx> {
                     // Calling an unstable function *always* requires that the corresponding gate
                     // (or implied gate) be enabled, even if the function has
                     // `#[rustc_allow_const_fn_unstable(the_gate)]`.
-                    let gate_declared = |gate| {
-                        tcx.features().declared_lib_features.iter().any(|&(sym, _)| sym == gate)
-                    };
+                    let gate_declared = |gate| tcx.features().declared(gate);
                     let feature_gate_declared = gate_declared(gate);
                     let implied_gate_declared = implied_by.is_some_and(gate_declared);
                     if !feature_gate_declared && !implied_gate_declared {