Skip to content

Commit fd6713f

Browse files
committed
Make mir dumps more readable
1 parent 7877d86 commit fd6713f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1740,6 +1740,10 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
17401740
" as ",
17411741
)?;
17421742
}
1743+
ty::Pat(base_ty, pat) => {
1744+
self.pretty_print_const_scalar_int(int, *base_ty, print_ty)?;
1745+
p!(write(" is {pat:?}"));
1746+
}
17431747
// Nontrivial types with scalar bit representation
17441748
_ => {
17451749
let print = |this: &mut Self| {

tests/mir-opt/pattern_types.main.PreCodegen.after.mir

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
fn main() -> () {
44
let mut _0: ();
55
scope 1 {
6-
debug x => const {transmute(0x00000002): (u32) is 1..=};
6+
debug x => const 2_u32 is 1..=;
77
scope 2 {
8-
debug y => const {transmute(0x00000000): (u32) is 1..=};
8+
debug y => const 0_u32 is 1..=;
99
}
1010
}
1111

tests/mir-opt/pattern_types.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use std::pat::pattern_type;
55

66
// EMIT_MIR pattern_types.main.PreCodegen.after.mir
77
fn main() {
8-
// CHECK: debug x => const {transmute(0x00000002): (u32) is 1..=}
8+
// CHECK: debug x => const 2_u32 is 1..=
99
let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(2) };
10-
// CHECK: debug y => const {transmute(0x00000000): (u32) is 1..=}
10+
// CHECK: debug y => const 0_u32 is 1..=
1111
let y: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) };
1212
}

0 commit comments

Comments
 (0)