1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
//@ check-pass
//@ run-rustfix
#![feature(f16, f128)]
fn main() {
let x = 5f16;
let _ = x == f16::NAN;
//~^ WARN incorrect NaN comparison
let _ = x != f16::NAN;
//~^ WARN incorrect NaN comparison
let x = 5f32;
let _ = x == f32::NAN;
//~^ WARN incorrect NaN comparison
let _ = x != f32::NAN;
//~^ WARN incorrect NaN comparison
let x = 5f64;
let _ = x == f64::NAN;
//~^ WARN incorrect NaN comparison
let _ = x != f64::NAN;
//~^ WARN incorrect NaN comparison
let x = 5f128;
let _ = x == f128::NAN;
//~^ WARN incorrect NaN comparison
let _ = x != f128::NAN;
//~^ WARN incorrect NaN comparison
let b = &2.3f32;
if b != &f32::NAN {}
//~^ WARN incorrect NaN comparison
let b = &2.3f32;
if b != { &f32::NAN } {}
//~^ WARN incorrect NaN comparison
let _ =
b != {
//~^ WARN incorrect NaN comparison
&f32::NAN
};
#[allow(unused_macros)]
macro_rules! nan { () => { f32::NAN }; }
macro_rules! number { () => { 5f32 }; }
let _ = nan!() == number!();
//~^ WARN incorrect NaN comparison
let _ = number!() != nan!();
//~^ WARN incorrect NaN comparison
}
|