Test for missing const-stability attributes
This commit is contained in:
parent
76c6f2dc3f
commit
6ce178f60e
2 changed files with 20 additions and 0 deletions
12
src/test/ui/stability-attribute/missing-const-stability.rs
Normal file
12
src/test/ui/stability-attribute/missing-const-stability.rs
Normal file
|
|
@ -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() {}
|
||||
|
|
@ -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
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue