mirror of https://github.com/rust-lang/rust.git
fixed if-condition match
This commit is contained in:
parent
8b9c2a79ed
commit
6aeb955214
|
@ -26,8 +26,8 @@ pub fn constant(cx: &Context, e: &Expr) -> Option<Constant> {
|
|||
&ExprBlock(ref block) => constant_block(cx, inner),
|
||||
&ExprIf(ref cond, ref then, ref otherwise) =>
|
||||
match constant(cx, cond) {
|
||||
Some(LitBool(true)) => constant(cx, then),
|
||||
Some(LitBool(false)) => constant(cx, otherwise),
|
||||
Some(ConstantBool(true)) => constant(cx, then),
|
||||
Some(ConstantBool(false)) => constant(cx, otherwise),
|
||||
_ => None,
|
||||
},
|
||||
&ExprLit(ref lit) => Some(lit_to_constant(lit)),
|
||||
|
|
Loading…
Reference in New Issue