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