]> git.proxmox.com Git - rustc.git/blob - tests/ui/rfc-1445-restrict-constants-in-patterns/issue-6804.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / rfc-1445-restrict-constants-in-patterns / 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 }