Add f16 and f128 to invalid_nan_comparison · rust-lang/rust@3afbe4f (original) (raw)

1

1

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

2

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs:6:13

`

``

2

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:8:13

`

3

3

` |

`

4

``

`-

LL | let _ = x == f32::NAN;

`

``

4

`+

LL | let _ = x == f16::NAN;

`

5

5

` | ^^^^^^^^^^^^^

`

6

6

` |

`

7

7

`` = note: #[warn(invalid_nan_comparisons)] on by default

``

8

8

`` help: use f32::is_nan() or f64::is_nan() instead

``

9

9

` |

`

``

10

`+

LL - let _ = x == f16::NAN;

`

``

11

`+

LL + let _ = x.is_nan();

`

``

12

`+

|

`

``

13

+

``

14

`+

warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

``

15

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:10:13

`

``

16

`+

|

`

``

17

`+

LL | let _ = x != f16::NAN;

`

``

18

`+

| ^^^^^^^^^^^^^

`

``

19

`+

|

`

``

20

`` +

help: use f32::is_nan() or f64::is_nan() instead

``

``

21

`+

|

`

``

22

`+

LL - let _ = x != f16::NAN;

`

``

23

`+

LL + let _ = !x.is_nan();

`

``

24

`+

|

`

``

25

+

``

26

`+

warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

``

27

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:14:13

`

``

28

`+

|

`

``

29

`+

LL | let _ = x == f32::NAN;

`

``

30

`+

| ^^^^^^^^^^^^^

`

``

31

`+

|

`

``

32

`` +

help: use f32::is_nan() or f64::is_nan() instead

``

``

33

`+

|

`

10

34

`LL - let _ = x == f32::NAN;

`

11

35

`LL + let _ = x.is_nan();

`

12

36

` |

`

13

37

``

14

38

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

15

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs:8:13

`

``

39

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:16:13

`

16

40

` |

`

17

41

`LL | let _ = x != f32::NAN;

`

18

42

` | ^^^^^^^^^^^^^

`

`@@ -24,7 +48,7 @@ LL + let _ = !x.is_nan();

`

24

48

` |

`

25

49

``

26

50

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

27

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs:12:13

`

``

51

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:20:13

`

28

52

` |

`

29

53

`LL | let _ = x == f64::NAN;

`

30

54

` | ^^^^^^^^^^^^^

`

`@@ -36,7 +60,7 @@ LL + let _ = x.is_nan();

`

36

60

` |

`

37

61

``

38

62

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

39

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs:14:13

`

``

63

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:22:13

`

40

64

` |

`

41

65

`LL | let _ = x != f64::NAN;

`

42

66

` | ^^^^^^^^^^^^^

`

`@@ -48,7 +72,31 @@ LL + let _ = !x.is_nan();

`

48

72

` |

`

49

73

``

50

74

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

51

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs🔞8

`

``

75

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:26:13

`

``

76

`+

|

`

``

77

`+

LL | let _ = x == f128::NAN;

`

``

78

`+

| ^^^^^^^^^^^^^^

`

``

79

`+

|

`

``

80

`` +

help: use f32::is_nan() or f64::is_nan() instead

``

``

81

`+

|

`

``

82

`+

LL - let _ = x == f128::NAN;

`

``

83

`+

LL + let _ = x.is_nan();

`

``

84

`+

|

`

``

85

+

``

86

`+

warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

``

87

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:28:13

`

``

88

`+

|

`

``

89

`+

LL | let _ = x != f128::NAN;

`

``

90

`+

| ^^^^^^^^^^^^^^

`

``

91

`+

|

`

``

92

`` +

help: use f32::is_nan() or f64::is_nan() instead

``

``

93

`+

|

`

``

94

`+

LL - let _ = x != f128::NAN;

`

``

95

`+

LL + let _ = !x.is_nan();

`

``

96

`+

|

`

``

97

+

``

98

`+

warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

``

99

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:32:8

`

52

100

` |

`

53

101

`LL | if b != &f32::NAN {}

`

54

102

` | ^^^^^^^^^^^^^^

`

`@@ -60,7 +108,7 @@ LL + if !b.is_nan() {}

`

60

108

` |

`

61

109

``

62

110

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

63

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs:22:8

`

``

111

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:36:8

`

64

112

` |

`

65

113

`LL | if b != { &f32::NAN } {}

`

66

114

` | ^^^^^^^^^^^^^^^^^^

`

`@@ -72,7 +120,7 @@ LL + if !b.is_nan() {}

`

72

120

` |

`

73

121

``

74

122

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

75

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs:26:9

`

``

123

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:40:9

`

76

124

` |

`

77

125

`LL | / b != {

`

78

126

`LL | |

`

`@@ -87,7 +135,7 @@ LL + !b.is_nan();

`

87

135

` |

`

88

136

``

89

137

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

90

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs:35:13

`

``

138

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:49:13

`

91

139

` |

`

92

140

`LL | let _ = nan!() == number!();

`

93

141

` | ^^^^^^^^^^^^^^^^^^^

`

`@@ -99,7 +147,7 @@ LL + let _ = number!().is_nan();

`

99

147

` |

`

100

148

``

101

149

`warning: incorrect NaN comparison, NaN cannot be directly compared to itself

`

102

``

`-

--> $DIR/invalid-nan-comparison-suggestion.rs:37:13

`

``

150

`+

--> $DIR/invalid-nan-comparison-suggestion.rs:51:13

`

103

151

` |

`

104

152

`LL | let _ = number!() != nan!();

`

105

153

` | ^^^^^^^^^^^^^^^^^^^

`

`@@ -110,5 +158,5 @@ LL - let _ = number!() != nan!();

`

110

158

`LL + let _ = !number!().is_nan();

`

111

159

` |

`

112

160

``

113

``

`-

warning: 9 warnings emitted

`

``

161

`+

warning: 13 warnings emitted

`

114

162

``