fn binary_ptr_op(
&self,
bin_op: mir::BinOp,
- left: ImmTy<'tcx, Tag>,
- right: ImmTy<'tcx, Tag>,
+ left: &ImmTy<'tcx, Tag>,
+ right: &ImmTy<'tcx, Tag>,
) -> InterpResult<'tcx, (Scalar<Tag>, bool, Ty<'tcx>)>;
fn ptr_eq(&self, left: Scalar<Tag>, right: Scalar<Tag>) -> InterpResult<'tcx, bool>;
fn binary_ptr_op(
&self,
bin_op: mir::BinOp,
- left: ImmTy<'tcx, Tag>,
- right: ImmTy<'tcx, Tag>,
+ left: &ImmTy<'tcx, Tag>,
+ right: &ImmTy<'tcx, Tag>,
) -> InterpResult<'tcx, (Scalar<Tag>, bool, Ty<'tcx>)> {
use rustc_middle::mir::BinOp::*;
Eq | Ne => {
// This supports fat pointers.
#[rustfmt::skip]
- let eq = match (*left, *right) {
+ let eq = match (**left, **right) {
(Immediate::Scalar(left), Immediate::Scalar(right)) => {
- self.ptr_eq(left.not_undef()?, right.not_undef()?)?
+ self.ptr_eq(left.check_init()?, right.check_init()?)?
}
(Immediate::ScalarPair(left1, left2), Immediate::ScalarPair(right1, right2)) => {
- self.ptr_eq(left1.not_undef()?, right1.not_undef()?)?
- && self.ptr_eq(left2.not_undef()?, right2.not_undef()?)?
+ self.ptr_eq(left1.check_init()?, right1.check_init()?)?
+ && self.ptr_eq(left2.check_init()?, right2.check_init()?)?
}
_ => bug!("Type system should not allow comparing Scalar with ScalarPair"),
};