diff options
| author | Oli Scherer <github333195615777966@oli-obk.de> | 2025-01-28 08:08:46 +0000 |
|---|---|---|
| committer | Oli Scherer <github333195615777966@oli-obk.de> | 2025-01-28 08:12:25 +0000 |
| commit | 7877d86163d802b2963d893850555d684c9d0eb1 (patch) | |
| tree | f3e7aba758055dd2a43c3cb535ac3a2705f78405 | |
| parent | 633a3fe36dd9a5196054dc3a61adbd3c61854dcf (diff) | |
| download | rust-7877d86163d802b2963d893850555d684c9d0eb1.tar.gz rust-7877d86163d802b2963d893850555d684c9d0eb1.zip | |
Add mir-opt pattern type tests
| -rw-r--r-- | tests/mir-opt/pattern_types.main.PreCodegen.after.mir | 15 | ||||
| -rw-r--r-- | tests/mir-opt/pattern_types.rs | 12 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tests/mir-opt/pattern_types.main.PreCodegen.after.mir b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir new file mode 100644 index 00000000000..e96526a01ff --- /dev/null +++ b/tests/mir-opt/pattern_types.main.PreCodegen.after.mir @@ -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; + } +} diff --git a/tests/mir-opt/pattern_types.rs b/tests/mir-opt/pattern_types.rs new file mode 100644 index 00000000000..3903fbad4ae --- /dev/null +++ b/tests/mir-opt/pattern_types.rs @@ -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) }; +} |
