about summary refs log tree commit diff
path: root/compiler/rustc_const_eval/src/interpret/step.rs
diff options
context:
space:
mode:
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-08-31 15:23:41 +0000
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>2022-09-06 14:18:32 +0000
commit104f97e5aa26287ed4b1c2bb4258557700a49da6 (patch)
tree60644513764121179efba266cc72d9acfde0463b /compiler/rustc_const_eval/src/interpret/step.rs
parentb7413511dc85ec01ef4b91785f86614589ac6103 (diff)
downloadrust-104f97e5aa26287ed4b1c2bb4258557700a49da6.tar.gz
rust-104f97e5aa26287ed4b1c2bb4258557700a49da6.zip
Move CTFE handling of nondiverging intrinsics to intrinsics.rs
Diffstat (limited to 'compiler/rustc_const_eval/src/interpret/step.rs')
-rw-r--r--compiler/rustc_const_eval/src/interpret/step.rs20
1 files changed, 2 insertions, 18 deletions
diff --git a/compiler/rustc_const_eval/src/interpret/step.rs b/compiler/rustc_const_eval/src/interpret/step.rs
index 3cf38258b75..c6e04cbfb6b 100644
--- a/compiler/rustc_const_eval/src/interpret/step.rs
+++ b/compiler/rustc_const_eval/src/interpret/step.rs
@@ -2,8 +2,8 @@
 //!
 //! The main entry point is the `step` method.
 
+use rustc_middle::mir;
 use rustc_middle::mir::interpret::{InterpResult, Scalar};
-use rustc_middle::mir::{self, NonDivergingIntrinsic};
 use rustc_middle::ty::layout::LayoutOf;
 
 use super::{InterpCx, Machine};
@@ -114,23 +114,7 @@ impl<'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> InterpCx<'mir, 'tcx, M> {
                 M::retag(self, *kind, &dest)?;
             }
 
-            Intrinsic(box NonDivergingIntrinsic::Assume(op)) => {
-                let op = self.eval_operand(op, None)?;
-                let cond = self.read_scalar(&op)?.to_bool()?;
-                if !cond {
-                    throw_ub_format!("`assume` called with `false`");
-                }
-            }
-            Intrinsic(box NonDivergingIntrinsic::CopyNonOverlapping(mir::CopyNonOverlapping {
-                ref count,
-                ref src,
-                ref dst,
-            })) => {
-                let src = self.eval_operand(src, None)?;
-                let dst = self.eval_operand(dst, None)?;
-                let count = self.eval_operand(count, None)?;
-                self.copy_intrinsic(&src, &dst, &count, /* nonoverlapping */ true)?;
-            }
+            Intrinsic(box ref intrinsic) => self.emulate_nondiverging_intrinsic(intrinsic)?,
 
             // Statements we do not track.
             AscribeUserType(..) => {}