]> git.lizzy.rs Git - rust.git/blob - src/test/ui/rfc-2632-const-trait-impl/staged-api.rs
Auto merge of #84589 - In-line:zircon-thread-name, r=JohnTitor
[rust.git] / src / test / ui / rfc-2632-const-trait-impl / staged-api.rs
1 // revisions: stock staged
2 #![cfg_attr(staged, feature(staged))]
3
4 #![feature(const_trait_impl)]
5 #![allow(incomplete_features)]
6
7 #![feature(staged_api)]
8 #![stable(feature = "rust1", since = "1.0.0")]
9
10 // aux-build: staged-api.rs
11 extern crate staged_api;
12
13 use staged_api::*;
14
15 #[stable(feature = "rust1", since = "1.0.0")]
16 pub struct Stable;
17
18 #[stable(feature = "rust1", since = "1.0.0")]
19 #[cfg_attr(staged, rustc_const_stable(feature = "rust1", since = "1.0.0"))]
20 // ^ should trigger error with or without the attribute
21 impl const MyTrait for Stable {
22     fn func() { //~ ERROR trait methods cannot be stable const fn
23
24     }
25 }
26
27 fn non_const_context() {
28     Unstable::func();
29     Stable::func();
30 }
31
32 #[unstable(feature = "none", issue = "none")]
33 const fn const_context() {
34     Unstable::func();
35     //[stock]~^ ERROR `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn
36     Stable::func();
37 }
38
39 fn main() {}