Skip to content

Commit

Permalink
Test for missing const-stability attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Sep 25, 2020
1 parent 76c6f2d commit 6ce178f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/test/ui/stability-attribute/missing-const-stability.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#![feature(staged_api)]

#![stable(feature = "rust1", since = "1.0.0")]

#[stable(feature = "foo", since = "1.0.0")]
pub const fn foo() {}
//~^ ERROR rustc_const_stable

#[unstable(feature = "bar", issue = "none")]
pub const fn bar() {} // ok

fn main() {}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
error: `#[stable]` const functions must also be either `#[rustc_const_stable]` or `#[rustc_const_unstable]`
--> $DIR/missing-const-stability.rs:6:1
|
LL | pub const fn foo() {}
| ^^^^^^^^^^^^^^^^^^^^^

error: aborting due to previous error

0 comments on commit 6ce178f

Please sign in to comment.