fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

master
3.8 KiB154 linesraw
1warning: incorrect NaN comparison, NaN cannot be directly compared to itself
2  --> $DIR/invalid-nan-comparison.rs:8:20
3   |
4LL | const TEST: bool = 5f32 == f32::NAN;
5   |                    ^^^^^^^^^^^^^^^^
6   |
7   = note: `#[warn(invalid_nan_comparisons)]` on by default
8
9warning: incorrect NaN comparison, NaN cannot be directly compared to itself
10  --> $DIR/invalid-nan-comparison.rs:14:5
11   |
12LL |     x == f32::NAN;
13   |     ^^^^^^^^^^^^^
14   |
15help: use `f32::is_nan()` or `f64::is_nan()` instead
16   |
17LL -     x == f32::NAN;
18LL +     x.is_nan();
19   |
20
21warning: incorrect NaN comparison, NaN cannot be directly compared to itself
22  --> $DIR/invalid-nan-comparison.rs:16:5
23   |
24LL |     x != f32::NAN;
25   |     ^^^^^^^^^^^^^
26   |
27help: use `f32::is_nan()` or `f64::is_nan()` instead
28   |
29LL -     x != f32::NAN;
30LL +     !x.is_nan();
31   |
32
33warning: incorrect NaN comparison, NaN is not orderable
34  --> $DIR/invalid-nan-comparison.rs:18:5
35   |
36LL |     x < f32::NAN;
37   |     ^^^^^^^^^^^^
38
39warning: incorrect NaN comparison, NaN is not orderable
40  --> $DIR/invalid-nan-comparison.rs:20:5
41   |
42LL |     x > f32::NAN;
43   |     ^^^^^^^^^^^^
44
45warning: incorrect NaN comparison, NaN is not orderable
46  --> $DIR/invalid-nan-comparison.rs:22:5
47   |
48LL |     x <= f32::NAN;
49   |     ^^^^^^^^^^^^^
50
51warning: incorrect NaN comparison, NaN is not orderable
52  --> $DIR/invalid-nan-comparison.rs:24:5
53   |
54LL |     x >= f32::NAN;
55   |     ^^^^^^^^^^^^^
56
57warning: incorrect NaN comparison, NaN cannot be directly compared to itself
58  --> $DIR/invalid-nan-comparison.rs:26:5
59   |
60LL |     number!() == f32::NAN;
61   |     ^^^^^^^^^^^^^^^^^^^^^
62   |
63help: use `f32::is_nan()` or `f64::is_nan()` instead
64   |
65LL -     number!() == f32::NAN;
66LL +     number!().is_nan();
67   |
68
69warning: incorrect NaN comparison, NaN cannot be directly compared to itself
70  --> $DIR/invalid-nan-comparison.rs:28:5
71   |
72LL |     f32::NAN != number!();
73   |     ^^^^^^^^^^^^^^^^^^^^^
74   |
75help: use `f32::is_nan()` or `f64::is_nan()` instead
76   |
77LL -     f32::NAN != number!();
78LL +     !number!().is_nan();
79   |
80
81warning: incorrect NaN comparison, NaN cannot be directly compared to itself
82  --> $DIR/invalid-nan-comparison.rs:35:5
83   |
84LL |     x == f64::NAN;
85   |     ^^^^^^^^^^^^^
86   |
87help: use `f32::is_nan()` or `f64::is_nan()` instead
88   |
89LL -     x == f64::NAN;
90LL +     x.is_nan();
91   |
92
93warning: incorrect NaN comparison, NaN cannot be directly compared to itself
94  --> $DIR/invalid-nan-comparison.rs:37:5
95   |
96LL |     x != f64::NAN;
97   |     ^^^^^^^^^^^^^
98   |
99help: use `f32::is_nan()` or `f64::is_nan()` instead
100   |
101LL -     x != f64::NAN;
102LL +     !x.is_nan();
103   |
104
105warning: incorrect NaN comparison, NaN is not orderable
106  --> $DIR/invalid-nan-comparison.rs:39:5
107   |
108LL |     x < f64::NAN;
109   |     ^^^^^^^^^^^^
110
111warning: incorrect NaN comparison, NaN is not orderable
112  --> $DIR/invalid-nan-comparison.rs:41:5
113   |
114LL |     x > f64::NAN;
115   |     ^^^^^^^^^^^^
116
117warning: incorrect NaN comparison, NaN is not orderable
118  --> $DIR/invalid-nan-comparison.rs:43:5
119   |
120LL |     x <= f64::NAN;
121   |     ^^^^^^^^^^^^^
122
123warning: incorrect NaN comparison, NaN is not orderable
124  --> $DIR/invalid-nan-comparison.rs:45:5
125   |
126LL |     x >= f64::NAN;
127   |     ^^^^^^^^^^^^^
128
129warning: incorrect NaN comparison, NaN cannot be directly compared to itself
130  --> $DIR/invalid-nan-comparison.rs:47:5
131   |
132LL |     number!() == f64::NAN;
133   |     ^^^^^^^^^^^^^^^^^^^^^
134   |
135help: use `f32::is_nan()` or `f64::is_nan()` instead
136   |
137LL -     number!() == f64::NAN;
138LL +     number!().is_nan();
139   |
140
141warning: incorrect NaN comparison, NaN cannot be directly compared to itself
142  --> $DIR/invalid-nan-comparison.rs:49:5
143   |
144LL |     f64::NAN != number!();
145   |     ^^^^^^^^^^^^^^^^^^^^^
146   |
147help: use `f32::is_nan()` or `f64::is_nan()` instead
148   |
149LL -     f64::NAN != number!();
150LL +     !number!().is_nan();
151   |
152
153warning: 17 warnings emitted
154