diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index 446bb3db0046..76503eb10fcf 100644 --- a/src/librustc/ty/print/pretty.rs +++ b/src/librustc/ty/print/pretty.rs @@ -988,9 +988,9 @@ pub trait PrettyPrinter<'tcx>: // For zsts just print their type as their value gives no extra information (Scalar::Raw { size: 0, .. }, _) => p!(print(ty)), // Nontrivial types with scalar bit representation - (Scalar::Raw { data, .. }, _) => { + (Scalar::Raw { data, size }, _) => { let print = |mut this: Self| { - write!(this, "transmute(0x{:x})", data)?; + write!(this, "transmute(0x{:01$x})", data, size as usize * 2)?; Ok(this) }; self = if print_ty { diff --git a/src/test/mir-opt/const_prop/discriminant.rs b/src/test/mir-opt/const_prop/discriminant.rs index 587f81f7f879..636aa1af6533 100644 --- a/src/test/mir-opt/const_prop/discriminant.rs +++ b/src/test/mir-opt/const_prop/discriminant.rs @@ -31,7 +31,7 @@ fn main() { // START rustc.main.ConstProp.after.mir // bb0: { // ... -// _3 = const {transmute(0x1): std::option::Option}; +// _3 = const {transmute(0x01): std::option::Option}; // _4 = const 1isize; // switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1]; // }