2016-10-27 00:38:18 +03:00
|
|
|
// Matching against NaN should result in a warning
|
|
|
|
|
2016-09-15 00:51:46 +03:00
|
|
|
#![allow(unused)]
|
2018-01-16 09:31:48 +01:00
|
|
|
#![deny(illegal_floating_point_literal_pattern)]
|
2016-09-15 00:51:46 +03:00
|
|
|
|
2020-10-24 19:21:40 -04:00
|
|
|
const NAN: f64 = f64::NAN;
|
2016-10-27 00:38:18 +03:00
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let x = NAN;
|
|
|
|
match x {
|
2018-01-16 09:31:48 +01:00
|
|
|
NAN => {}, //~ ERROR floating-point types cannot be used
|
2019-04-15 12:54:18 -07:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2016-10-27 00:38:18 +03:00
|
|
|
_ => {},
|
|
|
|
};
|
|
|
|
|
|
|
|
match [x, 1.0] {
|
2018-01-16 09:31:48 +01:00
|
|
|
[NAN, _] => {}, //~ ERROR floating-point types cannot be used
|
2020-01-08 20:02:10 +03:00
|
|
|
//~| WARN this was previously accepted by the compiler but is being phased out
|
2016-10-27 00:38:18 +03:00
|
|
|
_ => {},
|
|
|
|
};
|
|
|
|
}
|