rust/src/test/compile-fail/issue-6804.rs

22 lines
539 B
Rust
Raw Normal View History

// Matching against NaN should result in a warning
use std::f64::NAN;
fn main() {
let x = NAN;
match x {
NAN => {},
_ => {},
};
//~^^^ WARNING unmatchable NaN in pattern, use the is_nan method in a guard instead
match [x, 1.0] {
[NAN, _] => {},
_ => {},
};
//~^^^ WARNING unmatchable NaN in pattern, use the is_nan method in a guard instead
}
// At least one error is needed so that compilation fails
#[static_assert]
static b: bool = false; //~ ERROR static assertion failed