From 001ae69212a58766c007bf8464927e18fe406d0f Mon Sep 17 00:00:00 2001 From: Oliver Schneider Date: Mon, 20 Jun 2016 17:52:36 +0200 Subject: [PATCH] remove the bad rhs value error and panic instead. the typechecker prevent this --- src/error.rs | 4 ---- src/primval.rs | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/error.rs b/src/error.rs index 9e5e8997468..b19f63231af 100644 --- a/src/error.rs +++ b/src/error.rs @@ -5,7 +5,6 @@ use rustc::ty::BareFnTy; use memory::Pointer; use rustc_const_math::ConstMathErr; use syntax::codemap::Span; -use primval::PrimVal; #[derive(Clone, Debug)] pub enum EvalError<'tcx> { @@ -29,7 +28,6 @@ pub enum EvalError<'tcx> { ExecuteMemory, ArrayIndexOutOfBounds(Span, u64, u64), Math(Span, ConstMathErr), - InvalidBitShiftRhs(PrimVal), } pub type EvalResult<'tcx, T> = Result>; @@ -68,8 +66,6 @@ impl<'tcx> Error for EvalError<'tcx> { "array index out of bounds", EvalError::Math(..) => "mathematical operation failed", - EvalError::InvalidBitShiftRhs(..) => - "bit shift rhs not an int", } } diff --git a/src/primval.rs b/src/primval.rs index 29d79abbbfc..fbb93012885 100644 --- a/src/primval.rs +++ b/src/primval.rs @@ -91,7 +91,7 @@ pub fn binary_op<'tcx>(bin_op: mir::BinOp, left: PrimVal, right: PrimVal) -> Eva U16(i) => (i & ((1 << mask_bits) - 1)) as u32, U32(i) => (i & ((1 << mask_bits) - 1)) as u32, U64(i) => (i & ((1 << mask_bits) - 1)) as u32, - _ => return Err(EvalError::InvalidBitShiftRhs(right)), + _ => panic!("bad MIR: bitshift rhs is not integral"), }; macro_rules! shift { ($v:ident, $l:ident, $r:ident) => ({