1 // compile-flags: -Zmir-opt-level=0
4 #![feature(const_panic)]
5 #![feature(const_float_bits_conv)]
6 #![feature(const_float_classify)]
7 #![feature(const_trait_impl)]
8 #![allow(incomplete_features)]
11 const fn nop<T>(x: T) -> T { x }
13 macro_rules! const_assert {
14 ($a:expr, $b:expr) => {
16 const _: () = assert!($a == $b);
17 assert_eq!(nop($a), nop($b));
25 suite_inner!(f32 $($tt)*);
29 suite_inner!(f64 $($tt)*);
35 macro_rules! suite_inner {
37 $ty:ident [$( $fn:ident ),*]
38 $val:expr => [$($out:ident),*]
42 $( const_assert!($ty::$fn($val), $out); )*
43 suite_inner!($ty [$($fn),*] $($tail)*)
46 ( $ty:ident [$( $fn:ident ),*]) => {};
52 impl const PartialEq<NonDet> for bool {
53 fn eq(&self, _: &NonDet) -> bool {
56 fn ne(&self, _: &NonDet) -> bool {
61 // The result of the `is_sign` methods are not checked for correctness, since LLVM does not
62 // guarantee anything about the signedness of NaNs. See
63 // https://github.com/rust-lang/rust/issues/55131.
66 [is_nan, is_infinite, is_finite, is_normal, is_sign_positive, is_sign_negative]
67 -0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
68 0.0 / 0.0 => [ true, false, false, false, NonDet, NonDet]
69 1.0 => [ false, false, true, true, true, false]
70 -1.0 => [ false, false, true, true, false, true]
71 0.0 => [ false, false, true, false, true, false]
72 -0.0 => [ false, false, true, false, false, true]
73 1.0 / 0.0 => [ false, true, false, false, true, false]
74 -1.0 / 0.0 => [ false, true, false, false, false, true]