1 #![unstable(feature = "humans",
2 reason = "who ever let humans program computers,
3 we're apparently really bad at it",
6 #![feature(rustc_const_unstable, const_fn, foo, foo2)]
7 #![feature(staged_api)]
9 #[stable(feature = "rust1", since = "1.0.0")]
10 #[rustc_const_unstable(feature="foo")]
11 const unsafe fn foo() -> u32 { 42 }
13 #[stable(feature = "rust1", since = "1.0.0")]
14 // can't call non-min_const_fn
15 const unsafe fn bar() -> u32 { unsafe { foo() } } //~ ERROR can only call other `min_const_fn`
17 #[unstable(feature = "rust1", issue="0")]
18 const unsafe fn foo2() -> u32 { 42 }
20 #[stable(feature = "rust1", since = "1.0.0")]
21 // can't call non-min_const_fn
22 const unsafe fn bar2() -> u32 { unsafe { foo2() } } //~ ERROR can only call other `min_const_fn`
24 #[stable(feature = "rust1", since = "1.0.0")]
25 // conformity is required, even with `const_fn` feature gate
26 const unsafe fn bar3() -> u32 { (5f32 + 6f32) as u32 } //~ ERROR only int, `bool` and `char` op
28 // check whether this function cannot be called even with the feature gate active
29 #[unstable(feature = "foo2", issue="0")]
30 const unsafe fn foo2_gated() -> u32 { 42 }
32 #[stable(feature = "rust1", since = "1.0.0")]
33 // can't call non-min_const_fn
34 const unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() } } //~ ERROR can only call other