about summary refs log tree commit diff
path: root/compiler/rustc_middle/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2024-08-31 14:46:06 +0200
committerGitHub <noreply@github.com>2024-08-31 14:46:06 +0200
commitea5bb99c0f4ef142cd548e74b4e6857468385b7a (patch)
tree9f13fe3cf54175c03e70e5d86053469e3fe98c9c /compiler/rustc_middle/src
parent9649706eada1b2c68cf6504356efb058f68ad739 (diff)
parentc2984179d91654162fac32c60be6f9cec5d655cd (diff)
downloadrust-ea5bb99c0f4ef142cd548e74b4e6857468385b7a.tar.gz
rust-ea5bb99c0f4ef142cd548e74b4e6857468385b7a.zip
Rollup merge of #129659 - RalfJung:const-fn-lang-feat, r=fee1-dead
const fn stability checking: also check declared language features

Fixes https://github.com/rust-lang/rust/issues/129656

`@oli-obk` I assume it is just an oversight that this didn't use `features().declared()`? Or is there a deep reason that this must only check `declared_lib_features`?
Diffstat (limited to 'compiler/rustc_middle/src')
-rw-r--r--compiler/rustc_middle/src/ty/context.rs5
1 files changed, 1 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/context.rs b/compiler/rustc_middle/src/ty/context.rs
index d6dbad9dab8..43dda252f83 100644
--- a/compiler/rustc_middle/src/ty/context.rs
+++ b/compiler/rustc_middle/src/ty/context.rs
@@ -3093,10 +3093,7 @@ impl<'tcx> TyCtxt<'tcx> {
                 Some(stability) if stability.is_const_unstable() => {
                     // has a `rustc_const_unstable` attribute, check whether the user enabled the
                     // corresponding feature gate.
-                    self.features()
-                        .declared_lib_features
-                        .iter()
-                        .any(|&(sym, _)| sym == stability.feature)
+                    self.features().declared(stability.feature)
                 }
                 // functions without const stability are either stable user written
                 // const fn or the user is using feature gates and we thus don't