-
Notifications
You must be signed in to change notification settings - Fork 12.7k
/
staged-api.rs
39 lines (29 loc) · 935 Bytes
/
staged-api.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// revisions: stock staged
#![cfg_attr(staged, feature(staged))]
#![feature(const_trait_impl)]
#![allow(incomplete_features)]
#![feature(staged_api)]
#![stable(feature = "rust1", since = "1.0.0")]
// aux-build: staged-api.rs
extern crate staged_api;
use staged_api::*;
#[stable(feature = "rust1", since = "1.0.0")]
pub struct Stable;
#[stable(feature = "rust1", since = "1.0.0")]
#[cfg_attr(staged, rustc_const_stable(feature = "rust1", since = "1.0.0"))]
// ^ should trigger error with or without the attribute
impl const MyTrait for Stable {
fn func() { //~ ERROR trait methods cannot be stable const fn
}
}
fn non_const_context() {
Unstable::func();
Stable::func();
}
#[unstable(feature = "none", issue = "none")]
const fn const_context() {
Unstable::func();
//[stock]~^ ERROR `<staged_api::Unstable as staged_api::MyTrait>::func` is not yet stable as a const fn
Stable::func();
}
fn main() {}