11//@ compile-flags: -Zmir-opt-level=0 -Znext-solver
2- //@ known-bug: #110395
3- // FIXME(effects) run-pass
2+ //@ run-pass
3+
4+ // This tests the float classification functions, not just for const evaluation
5+ // but also for regular runtime code.
46
57#![ feature( const_float_bits_conv) ]
68#![ feature( const_float_classify) ]
7- #![ feature( const_trait_impl, effects) ]
8- #![ allow( incomplete_features) ]
9-
10- // Don't promote
11- const fn nop < T > ( x : T ) -> T { x }
129
13- impl const PartialEq < NonDet > for bool {
14- fn eq ( & self , _: & NonDet ) -> bool {
15- true
16- }
17- }
10+ use std:: hint:: black_box;
1811
1912macro_rules! const_assert {
13+ ( $a: expr, NonDet ) => {
14+ {
15+ const _: ( ) = { let _val = $a; } ;
16+ let _val = black_box( $a) ;
17+ }
18+ } ;
2019 ( $a: expr, $b: expr) => {
2120 {
2221 const _: ( ) = assert!( $a == $b) ;
23- assert!( nop ( $a) == nop ( $b) ) ;
22+ assert!( black_box ( $a) == black_box ( $b) ) ;
2423 }
2524 } ;
2625}
@@ -52,12 +51,9 @@ macro_rules! suite_inner {
5251 ( $ty: ident [ $( $fn: ident ) ,* ] ) => { } ;
5352}
5453
55- #[ derive( Debug ) ]
56- struct NonDet ;
57-
58- // The result of the `is_sign` methods are not checked for correctness, since LLVM does not
54+ // The result of the `is_sign` methods are not checked for correctness, since we do not
5955// guarantee anything about the signedness of NaNs. See
60- // https://github.com/ rust-lang/rust/issues/55131 .
56+ // https://rust-lang.github.io/rfcs/3514-float-semantics.html .
6157
6258suite ! {
6359 [ is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
@@ -74,4 +70,5 @@ suite! {
7470fn main ( ) {
7571 f32 ( ) ;
7672 f64 ( ) ;
73+ // FIXME(f16_f128): also test f16 and f128
7774}
0 commit comments