]> git.lizzy.rs Git - rust.git/blob - src/test/ui/issues/issue-6804.rs
325137327b26926492c0e2e9d6cc8e7e6c2ec0e3
[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 use std::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         //~| ERROR floating-point types cannot be used in patterns
14         //~| WARN this was previously accepted by the compiler but is being phased out
15         _ => {},
16     };
17
18     match [x, 1.0] {
19         [NAN, _] => {}, //~ ERROR floating-point types cannot be used
20                         //~| ERROR floating-point types cannot be used
21         //~| WARN this was previously accepted by the compiler but is being phased out
22         //~| WARN this was previously accepted by the compiler but is being phased out
23         _ => {},
24     };
25 }