Add comparison operators to boolean const eval.
This commit is contained in:
parent
9d4d0da7af
commit
f9c73adce8
2 changed files with 8 additions and 0 deletions
|
@ -732,6 +732,10 @@ pub fn eval_const_expr_partial<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
|||
hir::BiBitOr => a | b,
|
||||
hir::BiEq => a == b,
|
||||
hir::BiNe => a != b,
|
||||
hir::BiLt => a < b,
|
||||
hir::BiLe => a <= b,
|
||||
hir::BiGe => a >= b,
|
||||
hir::BiGt => a > b,
|
||||
_ => signal!(e, InvalidOpForBools(op.node)),
|
||||
})
|
||||
}
|
||||
|
|
|
@ -17,4 +17,8 @@ const X: *const u8 = b"" as _;
|
|||
fn main() {
|
||||
let _ = ((-1 as i8) << 8 - 1) as f32;
|
||||
let _ = 0u8 as char;
|
||||
let _ = true > false;
|
||||
let _ = true >= false;
|
||||
let _ = true < false;
|
||||
let _ = true >= false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue