Comparing Scalar's with differend defined values is false

This commit is contained in:
Oliver Schneider 2018-05-30 14:29:54 +02:00
parent b0ee05e861
commit f927014c8a

View File

@ -327,7 +327,7 @@ impl<'a, 'mir, 'tcx> EvalContextExt<'tcx> for EvalContext<'a, 'mir, 'tcx, super:
let a = self.value_to_scalar(args[0])?;
let b = self.value_to_scalar(args[1])?;
// check x % y != 0
if self.binary_op(mir::BinOp::Rem, a, ty, b, ty)?.0 != Scalar::null() {
if !self.binary_op(mir::BinOp::Rem, a, ty, b, ty)?.0.is_null()? {
return err!(ValidationFailure(format!("exact_div: {:?} cannot be divided by {:?}", a, b)));
}
let result = self.binary_op(mir::BinOp::Div, a, ty, b, ty)?;