Make newtype_index get debug_name using reflection

This commit is contained in:
Santiago Pastorino 2017-10-03 14:19:56 -03:00
parent 9af7426b47
commit 3502bec032
3 changed files with 6 additions and 1 deletions

View file

@ -40,6 +40,10 @@ impl Idx for u32 {
#[macro_export]
macro_rules! newtype_index {
($name:ident) => (
newtype_index!($name, unsafe { ::std::intrinsics::type_name::<$name>() });
);
($name:ident, $debug_name:expr) => (
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord,
RustcEncodable, RustcDecodable)]

View file

@ -18,6 +18,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
#![feature(box_patterns)]
#![feature(box_syntax)]
#![feature(core_intrinsics)]
#![feature(i128_type)]
#![feature(rustc_diagnostic_macros)]
#![feature(placement_in_syntax)]

View file

@ -155,4 +155,4 @@ struct Region {
points: FxHashSet<Location>,
}
newtype_index!(RegionIndex, "region_index");
newtype_index!(RegionIndex);