diff options
| author | Ralf Jung <post@ralfj.de> | 2020-05-01 10:56:17 +0200 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2020-05-01 10:56:17 +0200 |
| commit | cce0cb3c39e9a23cdb6d09d4258de2eded5b8f21 (patch) | |
| tree | 3a741cd536f7537639fef81a96fba861d5e3aa1f /src | |
| parent | 707bd7b21398044e4c2a84028b42dadbac5e91bc (diff) | |
| download | rust-cce0cb3c39e9a23cdb6d09d4258de2eded5b8f21.tar.gz rust-cce0cb3c39e9a23cdb6d09d4258de2eded5b8f21.zip | |
use hex for invalid bool and char (consistently with validation)
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_middle/mir/interpret/error.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/librustc_middle/mir/interpret/error.rs b/src/librustc_middle/mir/interpret/error.rs index 7710ed02551..40454ce3b2d 100644 --- a/src/librustc_middle/mir/interpret/error.rs +++ b/src/librustc_middle/mir/interpret/error.rs @@ -438,8 +438,12 @@ impl fmt::Display for UndefinedBehaviorInfo { WriteToReadOnly(a) => write!(f, "writing to {} which is read-only", a), DerefFunctionPointer(a) => write!(f, "accessing {} which contains a function", a), ValidationFailure(ref err) => write!(f, "type validation failed: {}", err), - InvalidBool(b) => write!(f, "interpreting an invalid 8-bit value as a bool: {}", b), - InvalidChar(c) => write!(f, "interpreting an invalid 32-bit value as a char: {}", c), + InvalidBool(b) => { + write!(f, "interpreting an invalid 8-bit value as a bool: 0x{:2x}", b) + } + InvalidChar(c) => { + write!(f, "interpreting an invalid 32-bit value as a char: 0x{:8x}", c) + } InvalidDiscriminant(val) => write!(f, "enum value has invalid discriminant: {}", val), InvalidFunctionPointer(p) => { write!(f, "using {} as function pointer but it does not point to a function", p) |
