about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2018-07-04 13:05:43 -0700
committerDylan MacKenzie <ecstaticmorse@gmail.com>2018-07-04 14:36:07 -0700
commitcf5eaa75bb171f00d6baa475333b741b86f93f72 (patch)
treea59313f9d783d9886c598d88aa6e0628fd515414
parentc395044a5002a9c275b92bc8e0bc54da245fa8b1 (diff)
downloadrust-cf5eaa75bb171f00d6baa475333b741b86f93f72.tar.gz
rust-cf5eaa75bb171f00d6baa475333b741b86f93f72.zip
Move `Eq + Hash + Clone` bounds to `Machine`
-rw-r--r--src/librustc_mir/interpret/eval_context.rs12
-rw-r--r--src/librustc_mir/interpret/machine.rs2
-rw-r--r--src/librustc_mir/interpret/step.rs6
3 files changed, 6 insertions, 14 deletions
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 363ad537b3f..a92c81e046a 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -163,7 +163,7 @@ pub(crate) struct InfiniteLoopDetector<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'mi
 }
 
 impl<'a, 'mir, 'tcx, M> Default for InfiniteLoopDetector<'a, 'mir, 'tcx, M>
-    where M: Eq + Hash + Machine<'mir, 'tcx>,
+    where M: Machine<'mir, 'tcx>,
           'tcx: 'a + 'mir,
 {
     fn default() -> Self {
@@ -175,7 +175,7 @@ impl<'a, 'mir, 'tcx, M> Default for InfiniteLoopDetector<'a, 'mir, 'tcx, M>
 }
 
 impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>
-    where M: Clone + Eq + Hash + Machine<'mir, 'tcx>,
+    where M: Machine<'mir, 'tcx>,
           'tcx: 'a + 'mir,
 {
     /// Returns `true` if the loop detector has not yet observed a snapshot.
@@ -302,9 +302,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
         param_env: ty::ParamEnv<'tcx>,
         machine: M,
         memory_data: M::MemoryData,
-    ) -> Self
-        where M: Eq + Hash
-    {
+    ) -> Self {
         EvalContext {
             machine,
             tcx,
@@ -612,9 +610,7 @@ impl<'a, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M
         &mut self,
         rvalue: &mir::Rvalue<'tcx>,
         place: &mir::Place<'tcx>,
-    ) -> EvalResult<'tcx>
-        where M: Clone + Eq + Hash,
-    {
+    ) -> EvalResult<'tcx> {
         let dest = self.eval_place(place)?;
         let dest_ty = self.place_ty(place);
 
diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs
index f6491d7f1a4..e2086c57c7c 100644
--- a/src/librustc_mir/interpret/machine.rs
+++ b/src/librustc_mir/interpret/machine.rs
@@ -15,7 +15,7 @@ use syntax::ast::Mutability;
 
 /// Methods of this trait signifies a point where CTFE evaluation would fail
 /// and some use case dependent behaviour can instead be applied
-pub trait Machine<'mir, 'tcx>: Sized {
+pub trait Machine<'mir, 'tcx>: Clone + Eq + Hash {
     /// Additional data that can be accessed via the Memory
     type MemoryData: Clone + Eq + Hash;
 
diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs
index 25f45fff04d..db90714d0e6 100644
--- a/src/librustc_mir/interpret/step.rs
+++ b/src/librustc_mir/interpret/step.rs
@@ -2,16 +2,12 @@
 //!
 //! The main entry point is the `step` method.
 
-use std::hash::Hash;
-
 use rustc::mir;
 
 use rustc::mir::interpret::EvalResult;
 use super::{EvalContext, Machine};
 
-impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
-    where M: Clone + Eq + Hash,
-{
+impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M> {
     pub fn inc_step_counter_and_detect_loops(&mut self) -> EvalResult<'tcx, ()> {
         /// The number of steps between loop detector snapshots.
         /// Should be a power of two for performance reasons.