2024-06-30 17:08:45 +00:00
|
|
|
//@ compile-flags: -Znext-solver
|
2020-09-25 20:51:52 +00:00
|
|
|
#![feature(staged_api)]
|
2024-10-06 17:59:19 +00:00
|
|
|
#![feature(const_trait_impl, effects, rustc_attrs, intrinsics)] //~ WARN the feature `effects` is incomplete
|
2021-11-18 02:06:17 +00:00
|
|
|
#![stable(feature = "stable", since = "1.0.0")]
|
2020-09-25 20:51:52 +00:00
|
|
|
|
2021-11-18 02:06:17 +00:00
|
|
|
#[stable(feature = "stable", since = "1.0.0")]
|
|
|
|
pub const fn foo() {} //~ ERROR function has missing const stability attribute
|
2020-09-25 20:51:52 +00:00
|
|
|
|
2021-11-18 02:06:17 +00:00
|
|
|
#[unstable(feature = "unstable", issue = "none")]
|
2021-11-18 02:08:16 +00:00
|
|
|
pub const fn bar() {} // ok because function is unstable
|
2020-09-25 20:51:52 +00:00
|
|
|
|
2021-11-18 02:06:17 +00:00
|
|
|
#[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
|
2021-11-18 02:06:17 +00:00
|
|
|
}
|
|
|
|
|
2022-02-13 10:54:00 +00:00
|
|
|
#[stable(feature = "stable", since = "1.0.0")]
|
2022-08-28 06:27:31 +00:00
|
|
|
#[const_trait]
|
2022-02-13 10:54:00 +00:00
|
|
|
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() {}
|
|
|
|
}
|
2020-09-25 20:51:52 +00:00
|
|
|
|
2024-10-06 17:59:19 +00:00
|
|
|
#[stable(feature = "stable", since = "1.0.0")]
|
|
|
|
#[rustc_intrinsic]
|
|
|
|
pub const unsafe fn size_of_val<T>(x: *const T) -> usize { 42 }
|
|
|
|
//~^ ERROR function has missing const stability attribute
|
|
|
|
|
|
|
|
extern "rust-intrinsic" {
|
|
|
|
#[stable(feature = "stable", since = "1.0.0")]
|
|
|
|
#[rustc_const_stable_indirect]
|
|
|
|
pub fn min_align_of_val<T>(x: *const T) -> usize;
|
|
|
|
}
|
|
|
|
|
2020-09-25 20:51:52 +00:00
|
|
|
fn main() {}
|