2019-11-28 18:00:00 -06:00
|
|
|
// This used to mis-compile because the mir-opt `SimplifyArmIdentity`
|
|
|
|
// did not check that the types matched up in the `Ok(r)` branch.
|
|
|
|
//
|
|
|
|
// run-pass
|
2021-03-04 07:35:11 -06:00
|
|
|
// compile-flags: -Zmir-opt-level=3
|
2019-11-28 18:00:00 -06:00
|
|
|
|
|
|
|
#[derive(Debug, PartialEq, Eq)]
|
|
|
|
enum SpecialsRes { Res(u64) }
|
|
|
|
|
|
|
|
fn e103() -> SpecialsRes {
|
|
|
|
if let Ok(r) = "1".parse() {
|
|
|
|
SpecialsRes::Res(r)
|
|
|
|
} else {
|
|
|
|
SpecialsRes::Res(42)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
assert_eq!(e103(), SpecialsRes::Res(1));
|
|
|
|
}
|