]> git.lizzy.rs Git - rust.git/blobdiff - src/operator.rs
fix newer getrandom on Windows
[rust.git] / src / operator.rs
index bfc8e908dc15b8c42274e073d981b6b118eae661..cf92aed9ccb2c5edcf98e451e042f56b142198e3 100644 (file)
@@ -8,8 +8,8 @@ pub trait EvalContextExt<'tcx> {
     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>;
@@ -19,8 +19,8 @@ impl<'mir, 'tcx> EvalContextExt<'tcx> for super::MiriEvalContext<'mir, 'tcx> {
     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::*;
 
@@ -30,13 +30,13 @@ fn binary_ptr_op(
             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"),
                 };