Make mir dumps more readable

This commit is contained in:
Oli Scherer 2025-01-27 15:19:49 +00:00
parent 7877d86163
commit fd6713fce1
3 changed files with 8 additions and 4 deletions

View File

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

View File

@ -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..=;
}
}

View File

@ -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) };
}