From aaa505af02bd7f449690e3febce342e96cc192a8 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Thu, 20 Sep 2018 08:26:02 +0200 Subject: [PATCH] remove some unused CTFE error variants --- src/librustc/ich/impls_ty.rs | 42 ------------------- src/librustc/mir/interpret/error.rs | 51 +----------------------- src/librustc_mir/transform/const_prop.rs | 4 -- 3 files changed, 1 insertion(+), 96 deletions(-) diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 0c38cb10a23..8f837327ddb 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -597,48 +597,6 @@ for ::mir::interpret::EvalErrorKind<'gcx, O> { required.hash_stable(hcx, hasher); has.hash_stable(hcx, hasher) }, - MemoryLockViolation { - ptr, - len, - frame, - access, - ref lock, - } => { - ptr.hash_stable(hcx, hasher); - len.hash_stable(hcx, hasher); - frame.hash_stable(hcx, hasher); - access.hash_stable(hcx, hasher); - lock.hash_stable(hcx, hasher) - }, - MemoryAcquireConflict { - ptr, - len, - kind, - ref lock, - } => { - ptr.hash_stable(hcx, hasher); - len.hash_stable(hcx, hasher); - kind.hash_stable(hcx, hasher); - lock.hash_stable(hcx, hasher) - }, - InvalidMemoryLockRelease { - ptr, - len, - frame, - ref lock, - } => { - ptr.hash_stable(hcx, hasher); - len.hash_stable(hcx, hasher); - frame.hash_stable(hcx, hasher); - lock.hash_stable(hcx, hasher) - }, - DeallocatedLockedMemory { - ptr, - ref lock, - } => { - ptr.hash_stable(hcx, hasher); - lock.hash_stable(hcx, hasher) - }, ValidationFailure(ref s) => s.hash_stable(hcx, hasher), TypeNotPrimitive(ty) => ty.hash_stable(hcx, hasher), ReallocatedWrongMemoryKind(ref a, ref b) => { diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index 6ce5e3f24ff..4e44587a672 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -15,9 +15,7 @@ use ty::{Ty, layout}; use ty::layout::{Size, Align, LayoutError}; use rustc_target::spec::abi::Abi; -use super::{ - Pointer, Lock, AccessKind -}; +use super::Pointer; use backtrace::Backtrace; @@ -274,29 +272,6 @@ pub enum EvalErrorKind<'tcx, O> { required: Align, has: Align, }, - MemoryLockViolation { - ptr: Pointer, - len: u64, - frame: usize, - access: AccessKind, - lock: Lock, - }, - MemoryAcquireConflict { - ptr: Pointer, - len: u64, - kind: AccessKind, - lock: Lock, - }, - InvalidMemoryLockRelease { - ptr: Pointer, - len: u64, - frame: usize, - lock: Lock, - }, - DeallocatedLockedMemory { - ptr: Pointer, - lock: Lock, - }, ValidationFailure(String), CalledClosureAsFunction, VtableForArgumentlessMethod, @@ -360,16 +335,8 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> { "pointer offset outside bounds of allocation", InvalidNullPointerUsage => "invalid use of NULL pointer", - MemoryLockViolation { .. } => - "memory access conflicts with lock", - MemoryAcquireConflict { .. } => - "new memory lock conflicts with existing lock", ValidationFailure(..) => "type validation failed", - InvalidMemoryLockRelease { .. } => - "invalid attempt to release write lock", - DeallocatedLockedMemory { .. } => - "tried to deallocate memory in conflict with a lock", ReadPointerAsBytes => "a raw memory access tried to access part of a pointer value as raw bytes", ReadBytesAsPointer => @@ -495,22 +462,6 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for EvalErrorKind<'tcx, O> { if access { "memory access" } else { "pointer computed" }, ptr.offset.bytes(), ptr.alloc_id, allocation_size.bytes()) }, - MemoryLockViolation { ptr, len, frame, access, ref lock } => { - write!(f, "{:?} access by frame {} at {:?}, size {}, is in conflict with lock {:?}", - access, frame, ptr, len, lock) - } - MemoryAcquireConflict { ptr, len, kind, ref lock } => { - write!(f, "new {:?} lock at {:?}, size {}, is in conflict with lock {:?}", - kind, ptr, len, lock) - } - InvalidMemoryLockRelease { ptr, len, frame, ref lock } => { - write!(f, "frame {} tried to release memory write lock at {:?}, size {}, but \ - cannot release lock {:?}", frame, ptr, len, lock) - } - DeallocatedLockedMemory { ptr, ref lock } => { - write!(f, "tried to deallocate memory at {:?} in conflict with lock {:?}", - ptr, lock) - } ValidationFailure(ref err) => { write!(f, "type validation failed: {}", err) } diff --git a/src/librustc_mir/transform/const_prop.rs b/src/librustc_mir/transform/const_prop.rs index 52de65c184a..8ee009db023 100644 --- a/src/librustc_mir/transform/const_prop.rs +++ b/src/librustc_mir/transform/const_prop.rs @@ -183,11 +183,7 @@ impl<'a, 'mir, 'tcx> ConstPropagator<'a, 'mir, 'tcx> { | InvalidDiscriminant(..) | PointerOutOfBounds { .. } | InvalidNullPointerUsage - | MemoryLockViolation { .. } - | MemoryAcquireConflict { .. } | ValidationFailure(..) - | InvalidMemoryLockRelease { .. } - | DeallocatedLockedMemory { .. } | InvalidPointerMath | ReadUndefBytes(_) | DeadLocal