about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2024-10-26 09:40:03 +0200
committerRalf Jung <post@ralfj.de>2024-10-28 11:48:39 +0100
commitd066dfdb835f15fe2c4d2bdb31d88cb948b360ad (patch)
treeec737bedc6aff10a4cd1ab2d9de28fa4a8280ef8 /tests/ui
parentf370f3493d3c85c7032a98e6c22b419251f18d2a (diff)
downloadrust-d066dfdb835f15fe2c4d2bdb31d88cb948b360ad.tar.gz
rust-d066dfdb835f15fe2c4d2bdb31d88cb948b360ad.zip
we can now enable the 'const stable fn must be stable' check
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/consts/rustc-const-stability-require-const.rs5
-rw-r--r--tests/ui/consts/rustc-const-stability-require-const.stderr22
2 files changed, 21 insertions, 6 deletions
diff --git a/tests/ui/consts/rustc-const-stability-require-const.rs b/tests/ui/consts/rustc-const-stability-require-const.rs
index 1c66f6e2aa5..6cc3f0f0da1 100644
--- a/tests/ui/consts/rustc-const-stability-require-const.rs
+++ b/tests/ui/consts/rustc-const-stability-require-const.rs
@@ -47,16 +47,15 @@ pub const fn foobar() {}
 pub const fn barfoo() {}
 
 // `rustc_const_stable` also requires the function to be stable.
-// FIXME: these are disabled until <https://github.com/rust-lang/stdarch/pull/1654> propagates.
 
 #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
 const fn barfoo_unmarked() {}
-// FIXME disabled ERROR can only be applied to functions that are declared `#[stable]`
+//~^ ERROR can only be applied to functions that are declared `#[stable]`
 
 #[unstable(feature = "unstable", issue = "none")]
 #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
 pub const fn barfoo_unstable() {}
-// FIXME disabled ERROR can only be applied to functions that are declared `#[stable]`
+//~^ ERROR can only be applied to functions that are declared `#[stable]`
 
 // `#[rustc_const_stable_indirect]` also requires a const fn
 #[rustc_const_stable_indirect]
diff --git a/tests/ui/consts/rustc-const-stability-require-const.stderr b/tests/ui/consts/rustc-const-stability-require-const.stderr
index 09b96ce6f83..d9a7d37cbcd 100644
--- a/tests/ui/consts/rustc-const-stability-require-const.stderr
+++ b/tests/ui/consts/rustc-const-stability-require-const.stderr
@@ -70,17 +70,33 @@ help: make the function or method const
 LL | pub extern "C" fn foo_c() {}
    | ^^^^^^^^^^^^^^^^^^^^^^^^^
 
+error: attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]`
+  --> $DIR/rustc-const-stability-require-const.rs:52:1
+   |
+LL | #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
+   | ---------------------------------------------------------------- attribute specified here
+LL | const fn barfoo_unmarked() {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+error: attribute `#[rustc_const_stable]` can only be applied to functions that are declared `#[stable]`
+  --> $DIR/rustc-const-stability-require-const.rs:57:1
+   |
+LL | #[rustc_const_stable(feature = "barfoo_const", since = "1.0.0")]
+   | ---------------------------------------------------------------- attribute specified here
+LL | pub const fn barfoo_unstable() {}
+   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
 error: attributes `#[rustc_const_unstable]`, `#[rustc_const_stable]` and `#[rustc_const_stable_indirect]` require the function or method to be `const`
-  --> $DIR/rustc-const-stability-require-const.rs:64:1
+  --> $DIR/rustc-const-stability-require-const.rs:63:1
    |
 LL | pub fn not_a_const_fn() {}
    | ^^^^^^^^^^^^^^^^^^^^^^^
    |
 help: make the function or method const
-  --> $DIR/rustc-const-stability-require-const.rs:64:1
+  --> $DIR/rustc-const-stability-require-const.rs:63:1
    |
 LL | pub fn not_a_const_fn() {}
    | ^^^^^^^^^^^^^^^^^^^^^^^
 
-error: aborting due to 7 previous errors
+error: aborting due to 9 previous errors