Add mir-opt pattern type tests

This commit is contained in:
Oli Scherer 2025-01-28 08:08:46 +00:00
parent 633a3fe36d
commit 7877d86163
2 changed files with 27 additions and 0 deletions

View file

@ -0,0 +1,15 @@
// MIR for `main` after PreCodegen
fn main() -> () {
let mut _0: ();
scope 1 {
debug x => const {transmute(0x00000002): (u32) is 1..=};
scope 2 {
debug y => const {transmute(0x00000000): (u32) is 1..=};
}
}
bb0: {
return;
}
}

View file

@ -0,0 +1,12 @@
#![feature(pattern_types)]
#![feature(pattern_type_macro)]
use std::pat::pattern_type;
// EMIT_MIR pattern_types.main.PreCodegen.after.mir
fn main() {
// CHECK: debug x => const {transmute(0x00000002): (u32) is 1..=}
let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(2) };
// CHECK: debug y => const {transmute(0x00000000): (u32) is 1..=}
let y: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) };
}