Add test for different NaNs
This commit is contained in:
parent
0dd13b0db2
commit
0c21a6b0c4
@ -249,6 +249,21 @@ fn if_same_then_else() -> Result<&'static str, ()> {
|
|||||||
-0.0
|
-0.0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Different NaNs
|
||||||
|
let _ = if true {
|
||||||
|
1.0 / 0.0
|
||||||
|
} else {
|
||||||
|
(-5f32).sqrt()
|
||||||
|
};
|
||||||
|
|
||||||
|
// Same NaNs
|
||||||
|
let _ = if true {
|
||||||
|
//~^NOTE same as this
|
||||||
|
std::f32::NAN
|
||||||
|
} else { //~ERROR this `if` has identical blocks
|
||||||
|
std::f32::NAN
|
||||||
|
};
|
||||||
|
|
||||||
let _ = match Some(()) {
|
let _ = match Some(()) {
|
||||||
Some(()) => 0.0,
|
Some(()) => 0.0,
|
||||||
None => -0.0
|
None => -0.0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user