1 #![unstable(feature = "humans",
2 reason = "who ever let humans program computers,
3 we're apparently really bad at it",
6 #![feature(const_fn_floating_point_arithmetic, foo, foo2)]
7 #![feature(staged_api)]
9 #[stable(feature = "rust1", since = "1.0.0")]
10 #[rustc_const_unstable(feature="foo", issue = "none")]
11 const fn foo() -> u32 { 42 }
13 #[stable(feature = "rust1", since = "1.0.0")]
14 #[rustc_const_stable(feature = "rust1", since = "1.0.0")]
15 // can't call non-min_const_fn
16 const fn bar() -> u32 { foo() } //~ ERROR not yet stable as a const fn
18 #[unstable(feature = "rust1", issue = "none")]
19 const fn foo2() -> u32 { 42 }
21 #[stable(feature = "rust1", since = "1.0.0")]
22 #[rustc_const_stable(feature = "rust1", since = "1.0.0")]
23 // can't call non-min_const_fn
24 const fn bar2() -> u32 { foo2() } //~ ERROR not yet stable as a const fn
26 #[stable(feature = "rust1", since = "1.0.0")]
27 #[rustc_const_stable(feature = "rust1", since = "1.0.0")]
28 // Const-stable functions cannot rely on unstable const-eval features.
29 const fn bar3() -> u32 { (5f32 + 6f32) as u32 }
30 //~^ ERROR const-stable function cannot use `#[feature(const_fn_floating_point_arithmetic)]`
32 // check whether this function cannot be called even with the feature gate active
33 #[unstable(feature = "foo2", issue = "none")]
34 const fn foo2_gated() -> u32 { 42 }
36 #[stable(feature = "rust1", since = "1.0.0")]
37 #[rustc_const_stable(feature = "rust1", since = "1.0.0")]
38 // can't call non-min_const_fn
39 const fn bar2_gated() -> u32 { foo2_gated() } //~ ERROR not yet stable as a const fn