]> git.lizzy.rs Git - rust.git/commitdiff
make LockInfo non-Copy
authorRalf Jung <post@ralfj.de>
Tue, 18 Jul 2017 23:43:37 +0000 (16:43 -0700)
committerOliver Schneider <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 25 Jul 2017 08:30:12 +0000 (10:30 +0200)
src/librustc_mir/interpret/error.rs
src/librustc_mir/interpret/memory.rs

index 0830db48d9f381fbfdc3aa5b263fa1ac80cc9e8f..ca740ff2d2c30f8cfb0b7886dabf45f33e761faf 100644 (file)
@@ -219,7 +219,7 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                        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 @@ fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
                 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)
             }
index 36fb69cbe5bc73f3754206bd5dcf35f1b1556db8..88e5ebe556f4c35e1b047dd1638864c1ef87108f 100644 (file)
@@ -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 @@ fn check_locks<'tcx>(&self, frame: usize, offset: u64, len: u64, access: AccessK
         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(())