X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Foperator.rs;h=1ce485682c770df2b681660aea927dc2a54184d6;hb=aadff8560b8b10842f444e00c9d33648b706d97b;hp=5eeed5eac635d14e75cd6833bc883466d8271fa3;hpb=310649bb8e528c8cc91a6467569ba474f22b2271;p=rust.git diff --git a/src/operator.rs b/src/operator.rs index 5eeed5eac63..1ce485682c7 100644 --- a/src/operator.rs +++ b/src/operator.rs @@ -64,12 +64,12 @@ fn ptr_op( assert!(right.layout.ty.is_integral()); let l_bits = self.force_bits(left.imm.to_scalar()?, left.layout.size)?; let r_bits = self.force_bits(right.imm.to_scalar()?, right.layout.size)?; - + let left = ImmTy::from_scalar(Scalar::from_uint(l_bits, left.layout.size), left.layout); let right = ImmTy::from_scalar(Scalar::from_uint(r_bits, left.layout.size), right.layout); return self.binary_op(bin_op, left, right); - } + } // Operations that support fat pointers match bin_op { @@ -298,11 +298,12 @@ fn pointer_offset_inbounds( pointee_ty: Ty<'tcx>, offset: i64, ) -> InterpResult<'tcx, Scalar> { + use rustc::mir::interpret::InterpError::Panic; // FIXME: assuming here that type size is less than `i64::max_value()`. let pointee_size = self.layout_of(pointee_ty)?.size.bytes() as i64; let offset = offset .checked_mul(pointee_size) - .ok_or_else(|| InterpError::Overflow(mir::BinOp::Mul))?; + .ok_or_else(|| Panic(PanicMessage::Overflow(mir::BinOp::Mul)))?; // Now let's see what kind of pointer this is. let ptr = if offset == 0 { match ptr {