Skip to content

Commit 7877d86

Browse files
committed
Add mir-opt pattern type tests
1 parent 633a3fe commit 7877d86

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// MIR for `main` after PreCodegen
2+
3+
fn main() -> () {
4+
let mut _0: ();
5+
scope 1 {
6+
debug x => const {transmute(0x00000002): (u32) is 1..=};
7+
scope 2 {
8+
debug y => const {transmute(0x00000000): (u32) is 1..=};
9+
}
10+
}
11+
12+
bb0: {
13+
return;
14+
}
15+
}

tests/mir-opt/pattern_types.rs

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#![feature(pattern_types)]
2+
#![feature(pattern_type_macro)]
3+
4+
use std::pat::pattern_type;
5+
6+
// EMIT_MIR pattern_types.main.PreCodegen.after.mir
7+
fn main() {
8+
// CHECK: debug x => const {transmute(0x00000002): (u32) is 1..=}
9+
let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(2) };
10+
// CHECK: debug y => const {transmute(0x00000000): (u32) is 1..=}
11+
let y: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) };
12+
}

0 commit comments

Comments
 (0)