Skip to content

Commit cce0cb3

Browse files
committed
use hex for invalid bool and char (consistently with validation)
1 parent 707bd7b commit cce0cb3

File tree

1 file changed

+6
-2
lines changed
  • src/librustc_middle/mir/interpret

1 file changed

+6
-2
lines changed

src/librustc_middle/mir/interpret/error.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -438,8 +438,12 @@ impl fmt::Display for UndefinedBehaviorInfo {
438438
WriteToReadOnly(a) => write!(f, "writing to {} which is read-only", a),
439439
DerefFunctionPointer(a) => write!(f, "accessing {} which contains a function", a),
440440
ValidationFailure(ref err) => write!(f, "type validation failed: {}", err),
441-
InvalidBool(b) => write!(f, "interpreting an invalid 8-bit value as a bool: {}", b),
442-
InvalidChar(c) => write!(f, "interpreting an invalid 32-bit value as a char: {}", c),
441+
InvalidBool(b) => {
442+
write!(f, "interpreting an invalid 8-bit value as a bool: 0x{:2x}", b)
443+
}
444+
InvalidChar(c) => {
445+
write!(f, "interpreting an invalid 32-bit value as a char: 0x{:8x}", c)
446+
}
443447
InvalidDiscriminant(val) => write!(f, "enum value has invalid discriminant: {}", val),
444448
InvalidFunctionPointer(p) => {
445449
write!(f, "using {} as function pointer but it does not point to a function", p)

0 commit comments

Comments
 (0)