1 #![unstable(feature = "humans",
2 reason
= "who ever let humans program computers,
3 we're apparently really bad at it",
6 #![feature(const_fn, 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 unsafe 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 unsafe fn bar() -> u32 { unsafe { foo() }
} //~ ERROR not yet stable as a const fn
18 #[unstable(feature = "rust1", issue = "none")]
19 const unsafe 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 unsafe fn bar2() -> u32 { unsafe { 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 // conformity is required, even with `const_fn` feature gate
29 const unsafe 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 unsafe 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 unsafe fn bar2_gated() -> u32 { unsafe { foo2_gated() }
}
40 //~^ ERROR not yet stable as a const fn