-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rollup merge of #136176 - oli-obk:pattern-type-mir-opts, r=compiler-e…
…rrors Render pattern types nicely in mir dumps avoid falling through to the fallback rendering that just does a hex dump r? ``@scottmcm`` best reviewed commit by commit
- Loading branch information
Showing
3 changed files
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// MIR for `main` after PreCodegen | ||
|
||
fn main() -> () { | ||
let mut _0: (); | ||
scope 1 { | ||
debug x => const 2_u32 is 1..=; | ||
scope 2 { | ||
debug y => const 0_u32 is 1..=; | ||
} | ||
} | ||
|
||
bb0: { | ||
return; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 2_u32 is 1..= | ||
let x: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(2) }; | ||
// CHECK: debug y => const 0_u32 is 1..= | ||
let y: pattern_type!(u32 is 1..) = unsafe { std::mem::transmute(0) }; | ||
} |