]>
Commit | Line | Data |
---|---|---|
0731742a XL |
1 | #![unstable(feature = "humans", |
2 | reason = "who ever let humans program computers, | |
3 | we're apparently really bad at it", | |
4 | issue = "0")] | |
5 | ||
60c5eb7d | 6 | #![feature(const_fn, foo, foo2)] |
0731742a XL |
7 | #![feature(staged_api)] |
8 | ||
9 | #[stable(feature = "rust1", since = "1.0.0")] | |
60c5eb7d | 10 | #[rustc_const_unstable(feature="foo", issue = "0")] |
0731742a XL |
11 | const fn foo() -> u32 { 42 } |
12 | ||
13 | #[stable(feature = "rust1", since = "1.0.0")] | |
60c5eb7d | 14 | #[rustc_const_stable(feature = "rust1", since = "1.0.0")] |
0731742a | 15 | // can't call non-min_const_fn |
48663c56 | 16 | const unsafe fn bar() -> u32 { foo() } //~ ERROR can only call other `const fn` |
0731742a XL |
17 | |
18 | #[unstable(feature = "rust1", issue="0")] | |
19 | const fn foo2() -> u32 { 42 } | |
20 | ||
21 | #[stable(feature = "rust1", since = "1.0.0")] | |
60c5eb7d | 22 | #[rustc_const_stable(feature = "rust1", since = "1.0.0")] |
0731742a | 23 | // can't call non-min_const_fn |
48663c56 | 24 | const unsafe fn bar2() -> u32 { foo2() } //~ ERROR can only call other `const fn` |
0731742a XL |
25 | |
26 | // check whether this function cannot be called even with the feature gate active | |
27 | #[unstable(feature = "foo2", issue="0")] | |
28 | const fn foo2_gated() -> u32 { 42 } | |
29 | ||
30 | #[stable(feature = "rust1", since = "1.0.0")] | |
60c5eb7d | 31 | #[rustc_const_stable(feature = "rust1", since = "1.0.0")] |
0731742a | 32 | // can't call non-min_const_fn |
48663c56 | 33 | const unsafe fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR can only call other `const fn` |
0731742a XL |
34 | |
35 | fn main() {} |