Skip to content

Commit b2e93a4

Browse files
committed
Print leading zeros for non pointers
1 parent b837e71 commit b2e93a4

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/librustc/ty/print/pretty.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,9 +988,9 @@ pub trait PrettyPrinter<'tcx>:
988988
// For zsts just print their type as their value gives no extra information
989989
(Scalar::Raw { size: 0, .. }, _) => p!(print(ty)),
990990
// Nontrivial types with scalar bit representation
991-
(Scalar::Raw { data, .. }, _) => {
991+
(Scalar::Raw { data, size }, _) => {
992992
let print = |mut this: Self| {
993-
write!(this, "transmute(0x{:x})", data)?;
993+
write!(this, "transmute(0x{:01$x})", data, size as usize * 2)?;
994994
Ok(this)
995995
};
996996
self = if print_ty {

src/test/mir-opt/const_prop/discriminant.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ fn main() {
3131
// START rustc.main.ConstProp.after.mir
3232
// bb0: {
3333
// ...
34-
// _3 = const {transmute(0x1): std::option::Option<bool>};
34+
// _3 = const {transmute(0x01): std::option::Option<bool>};
3535
// _4 = const 1isize;
3636
// switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1];
3737
// }

0 commit comments

Comments
 (0)