diff options
| author | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-02-10 17:05:18 +0100 |
|---|---|---|
| committer | Oliver Scherer <github35764891676564198441@oli-obk.de> | 2020-03-11 09:10:49 +0100 |
| commit | b2e93a41a653ea96954ae3780ea7d4c0368ed9c3 (patch) | |
| tree | d015555c16a8954bf4e68cd97939eaf2826a3f7d | |
| parent | b837e7173236b27ba76660864cd160aacbe66c57 (diff) | |
| download | rust-b2e93a41a653ea96954ae3780ea7d4c0368ed9c3.tar.gz rust-b2e93a41a653ea96954ae3780ea7d4c0368ed9c3.zip | |
Print leading zeros for non pointers
| -rw-r--r-- | src/librustc/ty/print/pretty.rs | 4 | ||||
| -rw-r--r-- | src/test/mir-opt/const_prop/discriminant.rs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/librustc/ty/print/pretty.rs b/src/librustc/ty/print/pretty.rs index 446bb3db004..76503eb10fc 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 587f81f7f87..636aa1af653 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<bool>}; +// _3 = const {transmute(0x01): std::option::Option<bool>}; // _4 = const 1isize; // switchInt(const 1isize) -> [1isize: bb2, otherwise: bb1]; // } |
