Skip to content

Commit 6ce178f

Browse files
Test for missing const-stability attributes
1 parent 76c6f2d commit 6ce178f

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(staged_api)]
2+
3+
#![stable(feature = "rust1", since = "1.0.0")]
4+
5+
#[stable(feature = "foo", since = "1.0.0")]
6+
pub const fn foo() {}
7+
//~^ ERROR rustc_const_stable
8+
9+
#[unstable(feature = "bar", issue = "none")]
10+
pub const fn bar() {} // ok
11+
12+
fn main() {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
error: `#[stable]` const functions must also be either `#[rustc_const_stable]` or `#[rustc_const_unstable]`
2+
--> $DIR/missing-const-stability.rs:6:1
3+
|
4+
LL | pub const fn foo() {}
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
7+
error: aborting due to previous error
8+

0 commit comments

Comments
 (0)