1
Fork 0

Print leading zeros for non pointers

This commit is contained in:
Oliver Scherer 2020-02-10 17:05:18 +01:00
parent b837e71732
commit b2e93a41a6
2 changed files with 3 additions and 3 deletions

View file

@ -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 {

View file

@ -31,7 +31,7 @@ fn main() {
// START rustc.main.ConstProp.after.mir
// bb0: {
// ...
// _3 = const {transmute(0x1): std::option::Option<bool>};
// _3 = const {transmute(0x01): std::option::Option<bool>};
// _4 = const 1isize;
// switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1];
// }