]> git.lizzy.rs Git - rust.git/blob - tests/ui/stability-attribute/missing-const-stability.rs
Rollup merge of #107740 - oli-obk:lock_tcx, r=petrochenkov
[rust.git] / tests / ui / stability-attribute / missing-const-stability.rs
1 #![feature(staged_api)]
2 #![feature(const_trait_impl)]
3 #![stable(feature = "stable", since = "1.0.0")]
4
5 #[stable(feature = "stable", since = "1.0.0")]
6 pub const fn foo() {} //~ ERROR function has missing const stability attribute
7
8 #[unstable(feature = "unstable", issue = "none")]
9 pub const fn bar() {} // ok because function is unstable
10
11 #[stable(feature = "stable", since = "1.0.0")]
12 pub struct Foo;
13 impl Foo {
14     #[stable(feature = "stable", since = "1.0.0")]
15     pub const fn foo() {} //~ ERROR associated function has missing const stability attribute
16
17     #[unstable(feature = "unstable", issue = "none")]
18     pub const fn bar() {} // ok because function is unstable
19 }
20
21 #[stable(feature = "stable", since = "1.0.0")]
22 #[const_trait]
23 pub trait Bar {
24     #[stable(feature = "stable", since = "1.0.0")]
25     fn fun();
26 }
27 #[stable(feature = "stable", since = "1.0.0")]
28 impl const Bar for Foo {
29     //~^ ERROR implementation has missing const stability attribute
30     fn fun() {}
31 }
32
33 fn main() {}