rust/tests/ui/stability-attribute/missing-const-stability.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

34 lines
993 B
Rust
Raw Normal View History

#![feature(staged_api)]
2021-11-18 02:08:16 +00:00
#![feature(const_trait_impl)]
#![stable(feature = "stable", since = "1.0.0")]
#[stable(feature = "stable", since = "1.0.0")]
pub const fn foo() {} //~ ERROR function has missing const stability attribute
#[unstable(feature = "unstable", issue = "none")]
2021-11-18 02:08:16 +00:00
pub const fn bar() {} // ok because function is unstable
#[stable(feature = "stable", since = "1.0.0")]
pub struct Foo;
impl Foo {
#[stable(feature = "stable", since = "1.0.0")]
pub const fn foo() {} //~ ERROR associated function has missing const stability attribute
#[unstable(feature = "unstable", issue = "none")]
2021-11-18 02:08:16 +00:00
pub const fn bar() {} // ok because function is unstable
}
#[stable(feature = "stable", since = "1.0.0")]
2022-08-28 06:27:31 +00:00
#[const_trait]
pub trait Bar {
#[stable(feature = "stable", since = "1.0.0")]
fn fun();
}
#[stable(feature = "stable", since = "1.0.0")]
impl const Bar for Foo {
//~^ ERROR implementation has missing const stability attribute
fn fun() {}
}
fn main() {}