From 8932aebfdfc8e4be18ed5213ba24f72954c7ba47 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Wed, 14 Jul 2021 10:52:08 +0200 Subject: [PATCH] remove unused error variant --- compiler/rustc_middle/src/mir/interpret/error.rs | 3 --- compiler/rustc_mir/src/interpret/validity.rs | 11 +++-------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/compiler/rustc_middle/src/mir/interpret/error.rs b/compiler/rustc_middle/src/mir/interpret/error.rs index 02a32b9fc6a..84241238276 100644 --- a/compiler/rustc_middle/src/mir/interpret/error.rs +++ b/compiler/rustc_middle/src/mir/interpret/error.rs @@ -397,8 +397,6 @@ pub enum UnsupportedOpInfo { // // The variants below are only reachable from CTFE/const prop, miri will never emit them. // - /// Encountered raw bytes where we needed a pointer. - ReadBytesAsPointer, /// Accessing thread local statics ThreadLocalStatic(DefId), /// Accessing an unsupported extern static. @@ -413,7 +411,6 @@ impl fmt::Display for UnsupportedOpInfo { ReadExternStatic(did) => write!(f, "cannot read from extern static ({:?})", did), NoMirFor(did) => write!(f, "no MIR body is available for {:?}", did), ReadPointerAsBytes => write!(f, "unable to turn pointer into raw bytes",), - ReadBytesAsPointer => write!(f, "unable to turn bytes into a pointer"), ThreadLocalStatic(did) => write!(f, "cannot access thread local static ({:?})", did), } } diff --git a/compiler/rustc_mir/src/interpret/validity.rs b/compiler/rustc_mir/src/interpret/validity.rs index c633c87e19e..2d4eb0b8238 100644 --- a/compiler/rustc_mir/src/interpret/validity.rs +++ b/compiler/rustc_mir/src/interpret/validity.rs @@ -335,8 +335,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, ' ), self.path, err_ub!(DanglingIntPointer(..)) | - err_ub!(PointerUseAfterFree(..)) | - err_unsup!(ReadBytesAsPointer) => + err_ub!(PointerUseAfterFree(..)) => { "dangling vtable pointer in wide pointer" }, err_ub!(AlignmentCheckFailed { .. }) => { "unaligned vtable pointer in wide pointer" }, @@ -347,8 +346,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, ' self.ecx.read_drop_type_from_vtable(vtable), self.path, err_ub!(DanglingIntPointer(..)) | - err_ub!(InvalidFunctionPointer(..)) | - err_unsup!(ReadBytesAsPointer) => + err_ub!(InvalidFunctionPointer(..)) => { "invalid drop function pointer in vtable (not pointing to a function)" }, err_ub!(InvalidVtableDropFn(..)) => { "invalid drop function pointer in vtable (function has incompatible signature)" }, @@ -437,8 +435,6 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, ' { "a dangling {} (address 0x{:x} is unallocated)", kind, i }, err_ub!(PointerOutOfBounds { .. }) => { "a dangling {} (going beyond the bounds of its allocation)", kind }, - err_unsup!(ReadBytesAsPointer) => - { "a dangling {} (created from integer)", kind }, // This cannot happen during const-eval (because interning already detects // dangling pointers), but it can happen in Miri. err_ub!(PointerUseAfterFree(..)) => @@ -598,8 +594,7 @@ impl<'rt, 'mir, 'tcx: 'mir, M: Machine<'mir, 'tcx>> ValidityVisitor<'rt, 'mir, ' self.path, err_ub!(DanglingIntPointer(..)) | err_ub!(InvalidFunctionPointer(..)) | - err_ub!(InvalidUninitBytes(None)) | - err_unsup!(ReadBytesAsPointer) => + err_ub!(InvalidUninitBytes(None)) => { "{}", value } expected { "a function pointer" }, ); // FIXME: Check if the signature matches