2013-07-24 11:00:33 -05:00
|
|
|
// 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 is_NaN() in a guard instead
|
2013-07-24 16:17:10 -05:00
|
|
|
match [x, 1.0] {
|
|
|
|
[NaN, _] => {},
|
|
|
|
_ => {},
|
|
|
|
};
|
|
|
|
//~^^^ WARNING unmatchable NaN in pattern, use is_NaN() in a guard instead
|
2013-07-24 11:00:33 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
// At least one error is needed so that compilation fails
|
|
|
|
#[static_assert]
|
|
|
|
static b: bool = false; //~ ERROR static assertion failed
|