about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2017-07-18 16:43:37 -0700
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>2017-07-25 10:30:12 +0200
commit0b15db0cc2f8529c518625e726241f6dbefb7efe (patch)
treef3136d92ff704b8586fbbfb1c13c2da88b873a57
parent59d49c5d6d8f68e39677aada438708158027d6f7 (diff)
downloadrust-0b15db0cc2f8529c518625e726241f6dbefb7efe.tar.gz
rust-0b15db0cc2f8529c518625e726241f6dbefb7efe.zip
make LockInfo non-Copy
-rw-r--r--src/librustc_mir/interpret/error.rs4
-rw-r--r--src/librustc_mir/interpret/memory.rs4
2 files changed, 4 insertions, 4 deletions
diff --git a/src/librustc_mir/interpret/error.rs b/src/librustc_mir/interpret/error.rs
index 0830db48d9f..ca740ff2d2c 100644
--- a/src/librustc_mir/interpret/error.rs
+++ b/src/librustc_mir/interpret/error.rs
@@ -219,7 +219,7 @@ impl<'tcx> fmt::Display for EvalError<'tcx> {
                        if access { "memory access" } else { "pointer computed" },
                        ptr.offset, ptr.alloc_id, allocation_size)
             },
-            MemoryLockViolation { ptr, len, access, lock } => {
+            MemoryLockViolation { ptr, len, access, ref lock } => {
                 write!(f, "{:?} access at {:?}, size {}, is in conflict with lock {:?}",
                        access, ptr, len, lock)
             }
@@ -227,7 +227,7 @@ impl<'tcx> fmt::Display for EvalError<'tcx> {
                 write!(f, "tried to release memory write lock at {:?}, size {}, but the write lock is held by someone else",
                        ptr, len)
             }
-            DeallocatedLockedMemory { ptr, lock } => {
+            DeallocatedLockedMemory { ptr, ref lock } => {
                 write!(f, "tried to deallocate memory at {:?} in conflict with lock {:?}",
                        ptr, lock)
             }
diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs
index 36fb69cbe5b..88e5ebe556f 100644
--- a/src/librustc_mir/interpret/memory.rs
+++ b/src/librustc_mir/interpret/memory.rs
@@ -96,7 +96,7 @@ enum LockStatus {
 }
 
 /// Information about a lock that is or will be held.
-#[derive(Copy, Clone, Debug)]
+#[derive(Clone, Debug)]
 pub struct LockInfo {
     kind: AccessKind,
     lifetime: DynamicLifetime,
@@ -168,7 +168,7 @@ impl Allocation {
         for lock in self.iter_locks(offset, len) {
             // Check if the lock is active, and is in conflict with the access.
             if lock.status == LockStatus::Held && !lock.access_permitted(frame, access) {
-                return Err(*lock);
+                return Err(lock.clone());
             }
         }
         Ok(())