diff options
| author | Ralf Jung <post@ralfj.de> | 2018-08-26 14:22:59 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-08-28 19:57:05 +0200 |
| commit | f96208ca5bd34ba5e9106fe6527db43a9bdc3a8f (patch) | |
| tree | 18857fb568c05f46f5b242ce3782c5103accb457 /src/librustc | |
| parent | 6c78fa822a311e30e6421525570f472bf19e32fd (diff) | |
| download | rust-f96208ca5bd34ba5e9106fe6527db43a9bdc3a8f.tar.gz rust-f96208ca5bd34ba5e9106fe6527db43a9bdc3a8f.zip | |
address nits
Diffstat (limited to 'src/librustc')
| -rw-r--r-- | src/librustc/ich/impls_ty.rs | 2 | ||||
| -rw-r--r-- | src/librustc/mir/interpret/error.rs | 8 | ||||
| -rw-r--r-- | src/librustc/ty/structural_impls.rs | 2 |
3 files changed, 7 insertions, 5 deletions
diff --git a/src/librustc/ich/impls_ty.rs b/src/librustc/ich/impls_ty.rs index 6ee0eb273d6..c598f99a2b5 100644 --- a/src/librustc/ich/impls_ty.rs +++ b/src/librustc/ich/impls_ty.rs @@ -517,7 +517,6 @@ for ::mir::interpret::EvalErrorKind<'gcx, O> { InvalidMemoryAccess | InvalidFunctionPointer | InvalidBool | - InvalidDiscriminant | InvalidNullPointerUsage | ReadPointerAsBytes | ReadBytesAsPointer | @@ -550,6 +549,7 @@ for ::mir::interpret::EvalErrorKind<'gcx, O> { GeneratorResumedAfterReturn | GeneratorResumedAfterPanic | InfiniteLoop => {} + InvalidDiscriminant(val) => val.hash_stable(hcx, hasher), Panic { ref msg, ref file, line, col } => { msg.hash_stable(hcx, hasher); file.hash_stable(hcx, hasher); diff --git a/src/librustc/mir/interpret/error.rs b/src/librustc/mir/interpret/error.rs index c62ed841866..ab38f8fa721 100644 --- a/src/librustc/mir/interpret/error.rs +++ b/src/librustc/mir/interpret/error.rs @@ -190,7 +190,7 @@ pub enum EvalErrorKind<'tcx, O> { InvalidMemoryAccess, InvalidFunctionPointer, InvalidBool, - InvalidDiscriminant, + InvalidDiscriminant(u128), PointerOutOfBounds { ptr: Pointer, access: bool, @@ -302,8 +302,8 @@ impl<'tcx, O> EvalErrorKind<'tcx, O> { "tried to use a function pointer after offsetting it", InvalidBool => "invalid boolean value read", - InvalidDiscriminant => - "invalid enum discriminant value read or written", + InvalidDiscriminant(..) => + "invalid enum discriminant value read", PointerOutOfBounds { .. } => "pointer offset outside bounds of allocation", InvalidNullPointerUsage => @@ -488,6 +488,8 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for EvalErrorKind<'tcx, O> { align {}", size.bytes(), align.abi(), size2.bytes(), align2.abi()), Panic { ref msg, line, col, ref file } => write!(f, "the evaluated program panicked at '{}', {}:{}:{}", msg, file, line, col), + InvalidDiscriminant(val) => + write!(f, "encountered invalid enum discriminant {}", val), _ => write!(f, "{}", self.description()), } } diff --git a/src/librustc/ty/structural_impls.rs b/src/librustc/ty/structural_impls.rs index 55a1eadb06f..1f3c3140504 100644 --- a/src/librustc/ty/structural_impls.rs +++ b/src/librustc/ty/structural_impls.rs @@ -498,7 +498,7 @@ impl<'a, 'tcx, O: Lift<'tcx>> Lift<'tcx> for interpret::EvalErrorKind<'a, O> { InvalidMemoryAccess => InvalidMemoryAccess, InvalidFunctionPointer => InvalidFunctionPointer, InvalidBool => InvalidBool, - InvalidDiscriminant => InvalidDiscriminant, + InvalidDiscriminant(val) => InvalidDiscriminant(val), PointerOutOfBounds { ptr, access, |
