1
1
//@ 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.
4
6
5
7
#![ feature( const_float_bits_conv) ]
6
8
#![ 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 }
12
9
13
- impl const PartialEq < NonDet > for bool {
14
- fn eq ( & self , _: & NonDet ) -> bool {
15
- true
16
- }
17
- }
10
+ use std:: hint:: black_box;
18
11
19
12
macro_rules! const_assert {
13
+ ( $a: expr, NonDet ) => {
14
+ {
15
+ const _: ( ) = { let _val = $a; } ;
16
+ let _val = black_box( $a) ;
17
+ }
18
+ } ;
20
19
( $a: expr, $b: expr) => {
21
20
{
22
21
const _: ( ) = assert!( $a == $b) ;
23
- assert!( nop ( $a) == nop ( $b) ) ;
22
+ assert!( black_box ( $a) == black_box ( $b) ) ;
24
23
}
25
24
} ;
26
25
}
@@ -52,12 +51,9 @@ macro_rules! suite_inner {
52
51
( $ty: ident [ $( $fn: ident ) ,* ] ) => { } ;
53
52
}
54
53
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
59
55
// 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 .
61
57
62
58
suite ! {
63
59
[ is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
@@ -74,4 +70,5 @@ suite! {
74
70
fn main ( ) {
75
71
f32 ( ) ;
76
72
f64 ( ) ;
73
+ // FIXME(f16_f128): also test f16 and f128
77
74
}
0 commit comments