Skip to content

Commit c62873e

Browse files
committed
Make mir dumps more readable
1 parent 9774687 commit c62873e

10 files changed

+13
-9
lines changed

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

Lines changed: 4 additions & 0 deletions
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/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
StorageLive(_4);
4646
StorageLive(_5);
4747
StorageLive(_6);
48-
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x00000001): (usize) is 1..=usize::MAX}));
48+
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
4949
StorageLive(_7);
5050
_7 = const {0x1 as *const [bool; 0]};
5151
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.32bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
StorageLive(_4);
4646
StorageLive(_5);
4747
StorageLive(_6);
48-
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x00000001): (usize) is 1..=usize::MAX}));
48+
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
4949
StorageLive(_7);
5050
_7 = const {0x1 as *const [bool; 0]};
5151
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
StorageLive(_4);
4646
StorageLive(_5);
4747
StorageLive(_6);
48-
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x0000000000000001): (usize) is 1..=usize::MAX}));
48+
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
4949
StorageLive(_7);
5050
_7 = const {0x1 as *const [bool; 0]};
5151
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.DataflowConstProp.64bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
StorageLive(_4);
4646
StorageLive(_5);
4747
StorageLive(_6);
48-
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x0000000000000001): (usize) is 1..=usize::MAX}));
48+
_6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
4949
StorageLive(_7);
5050
_7 = const {0x1 as *const [bool; 0]};
5151
_5 = const NonNull::<[bool; 0]> {{ pointer: {0x1 as *const [bool; 0]} }};

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
StorageLive(_5);
4747
StorageLive(_6);
4848
- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero<usize> (Transmute);
49-
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x00000001): (usize) is 1..=usize::MAX}));
49+
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
5050
StorageLive(_7);
5151
- _7 = copy _6 as *const [bool; 0] (Transmute);
5252
- _5 = NonNull::<[bool; 0]> { pointer: copy _7 };

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.32bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
StorageLive(_5);
4747
StorageLive(_6);
4848
- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero<usize> (Transmute);
49-
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x00000001): (usize) is 1..=usize::MAX}));
49+
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
5050
StorageLive(_7);
5151
- _7 = copy _6 as *const [bool; 0] (Transmute);
5252
- _5 = NonNull::<[bool; 0]> { pointer: copy _7 };

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-abort.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
StorageLive(_5);
4747
StorageLive(_6);
4848
- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero<usize> (Transmute);
49-
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x0000000000000001): (usize) is 1..=usize::MAX}));
49+
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
5050
StorageLive(_7);
5151
- _7 = copy _6 as *const [bool; 0] (Transmute);
5252
- _5 = NonNull::<[bool; 0]> { pointer: copy _7 };

tests/mir-opt/dataflow-const-prop/default_boxed_slice.main.GVN.64bit.panic-unwind.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
StorageLive(_5);
4747
StorageLive(_6);
4848
- _6 = const std::ptr::Alignment::of::<[bool; 0]>::{constant#0} as std::num::NonZero<usize> (Transmute);
49-
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x0000000000000001): (usize) is 1..=usize::MAX}));
49+
+ _6 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
5050
StorageLive(_7);
5151
- _7 = copy _6 as *const [bool; 0] (Transmute);
5252
- _5 = NonNull::<[bool; 0]> { pointer: copy _7 };

tests/mir-opt/gvn_ptr_eq_with_constant.main.GVN.diff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
StorageLive(_3);
4343
- _3 = const std::ptr::Alignment::of::<u8>::{constant#0} as std::num::NonZero<usize> (Transmute);
4444
- _2 = copy _3 as *mut u8 (Transmute);
45-
+ _3 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner({transmute(0x0000000000000001): (usize) is 1..=usize::MAX}));
45+
+ _3 = const NonZero::<usize>(core::num::niche_types::NonZeroUsizeInner(1_usize is 1..=usize::MAX));
4646
+ _2 = const {0x1 as *mut u8};
4747
StorageDead(_3);
4848
StorageLive(_4);

0 commit comments

Comments
 (0)