about summary refs log tree commit diff
diff options
context:
space:
mode:
authorOli Scherer <github333195615777966@oli-obk.de>2025-01-27 15:19:49 +0000
committerOli Scherer <github333195615777966@oli-obk.de>2025-01-28 08:19:31 +0000
commitfd6713fce1d06ba283bc27331df354b7a9443d6b (patch)
treee8846b557eabbf320d1008393121c9d183acebb2
parent7877d86163d802b2963d893850555d684c9d0eb1 (diff)
downloadrust-fd6713fce1d06ba283bc27331df354b7a9443d6b.tar.gz
rust-fd6713fce1d06ba283bc27331df354b7a9443d6b.zip
Make mir dumps more readable
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs4
-rw-r--r--tests/mir-opt/pattern_types.main.PreCodegen.after.mir4
-rw-r--r--tests/mir-opt/pattern_types.rs4
3 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index ac900edefe1..027a4315b4b 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -1740,6 +1740,10 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
                     " as ",
                 )?;
             }
+            ty::Pat(base_ty, pat) => {
+                self.pretty_print_const_scalar_int(int, *base_ty, print_ty)?;
+                p!(write(" is {pat:?}"));
+            }
             // Nontrivial types with scalar bit representation
             _ => {
                 let print = |this: &mut Self| {
diff --git a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir
index e96526a01ff..8c99902f9b8 100644
--- a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir
+++ b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir
@@ -3,9 +3,9 @@
 fn main() -> () {
     let mut _0: ();
     scope 1 {
-        debug x => const {transmute(0x00000002): (u32) is 1..=};
+        debug x => const 2_u32 is 1..=;
         scope 2 {
-            debug y => const {transmute(0x00000000): (u32) is 1..=};
+            debug y => const 0_u32 is 1..=;
         }
     }
 
diff --git a/tests/mir-opt/pattern_types.rs b/tests/mir-opt/pattern_types.rs
index 3903fbad4ae..217c64b90cb 100644
--- a/tests/mir-opt/pattern_types.rs
+++ b/tests/mir-opt/pattern_types.rs
@@ -5,8 +5,8 @@ use std::pat::pattern_type;
 
 // EMIT_MIR pattern_types.main.PreCodegen.after.mir
 fn main() {
-    // CHECK: debug x => const {transmute(0x00000002): (u32) is 1..=}
+    // CHECK: debug x => const 2_u32 is 1..=
     let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(2) };
-    // CHECK: debug y => const {transmute(0x00000000): (u32) is 1..=}
+    // CHECK: debug y => const 0_u32 is 1..=
     let y: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) };
 }