mirror of
https://github.com/rust-lang/rust.git
synced 2026-06-01 14:10:03 +03:00
make LockInfo non-Copy
This commit is contained in:
committed by
Oliver Schneider
parent
59d49c5d6d
commit
0b15db0cc2
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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(())
|
||||
|
||||
Reference in New Issue
Block a user