rust/src/test/compile-fail/issue-6804.rs
2013-07-25 16:40:59 +02:00

22 lines
541 B
Rust

// Matching against NaN should result in a warning
use std::float::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