Skip to content

Commit 3502bec

Browse files
committed
Make newtype_index get debug_name using reflection
1 parent 9af7426 commit 3502bec

File tree

3 files changed

+6
-1
lines changed

3 files changed

+6
-1
lines changed

src/librustc_data_structures/indexed_vec.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ impl Idx for u32 {
4040

4141
#[macro_export]
4242
macro_rules! newtype_index {
43+
($name:ident) => (
44+
newtype_index!($name, unsafe { ::std::intrinsics::type_name::<$name>() });
45+
);
46+
4347
($name:ident, $debug_name:expr) => (
4448
#[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord,
4549
RustcEncodable, RustcDecodable)]

src/librustc_mir/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ Rust MIR: a lowered representation of Rust. Also: an experiment!
1818

1919
#![feature(box_patterns)]
2020
#![feature(box_syntax)]
21+
#![feature(core_intrinsics)]
2122
#![feature(i128_type)]
2223
#![feature(rustc_diagnostic_macros)]
2324
#![feature(placement_in_syntax)]

src/librustc_mir/transform/nll/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,4 +155,4 @@ struct Region {
155155
points: FxHashSet<Location>,
156156
}
157157

158-
newtype_index!(RegionIndex, "region_index");
158+
newtype_index!(RegionIndex);

0 commit comments

Comments
 (0)