]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-6804.rs
Rollup merge of #86747 - FabianWolff:issue-86653, r=GuillaumeGomez
[rust.git] / src / test / ui / issues / issue-6804.rs
1 // Matching against NaN should result in a warning
2
3 #![allow(unused)]
4 #![deny(illegal_floating_point_literal_pattern)]
5
6 const NAN: f64 = f64::NAN;
7
8 fn main() {
9     let x = NAN;
10     match x {
11         NAN => {}, //~ ERROR floating-point types cannot be used
12         //~| WARN this was previously accepted by the compiler but is being phased out
13         _ => {},
14     };
15
16     match [x, 1.0] {
17         [NAN, _] => {}, //~ ERROR floating-point types cannot be used
18         //~| WARN this was previously accepted by the compiler but is being phased out
19         _ => {},
20     };
21 }