about summary refs log tree commit diff
path: root/tests
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 /tests
parent9649706eada1b2c68cf6504356efb058f68ad739 (diff)
parentc2984179d91654162fac32c60be6f9cec5d655cd (diff)
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 'tests')
-rw-r--r--tests/ui/consts/min_const_fn/const-fn-lang-feature.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/consts/min_const_fn/const-fn-lang-feature.rs b/tests/ui/consts/min_const_fn/const-fn-lang-feature.rs
new file mode 100644
index 00000000000..63ef12085f1
--- /dev/null
+++ b/tests/ui/consts/min_const_fn/const-fn-lang-feature.rs
@@ -0,0 +1,20 @@
+//! Ensure that we can use a language feature with a `const fn`:
+//! enabling the feature gate actually lets us call the function.
+//@ check-pass
+
+#![feature(staged_api, abi_unadjusted)]
+#![stable(feature = "rust_test", since = "1.0.0")]
+
+#[unstable(feature = "abi_unadjusted", issue = "42")]
+#[rustc_const_unstable(feature = "abi_unadjusted", issue = "42")]
+const fn my_fun() {}
+
+#[unstable(feature = "abi_unadjusted", issue = "42")]
+#[rustc_const_unstable(feature = "abi_unadjusted", issue = "42")]
+const fn my_fun2() {
+    my_fun()
+}
+
+fn main() {
+    const { my_fun2() };
+}