1 // gate-test-const_fn_floating_point_arithmetic
3 // revisions: stock gated
5 #![feature(rustc_attrs)]
6 #![cfg_attr(gated, feature(const_fn_floating_point_arithmetic))]
8 const fn add(f: f32) -> f32 { f + 2.0 }
9 //[stock]~^ floating point arithmetic
10 const fn sub(f: f32) -> f32 { 2.0 - f }
11 //[stock]~^ floating point arithmetic
12 const fn mul(f: f32, g: f32) -> f32 { f * g }
13 //[stock]~^ floating point arithmetic
14 const fn div(f: f32, g: f32) -> f32 { f / g }
15 //[stock]~^ floating point arithmetic
16 const fn neg(f: f32) -> f32 { -f }
17 //[stock]~^ floating point arithmetic
20 fn main() {} //[gated]~ fatal error triggered by #[rustc_error]