From 3502bec0322829d8bbe61b65c62bb796814e4bd3 Mon Sep 17 00:00:00 2001 From: Santiago Pastorino Date: Tue, 3 Oct 2017 14:19:56 -0300 Subject: Make newtype_index get debug_name using reflection --- src/librustc_data_structures/indexed_vec.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/librustc_data_structures') diff --git a/src/librustc_data_structures/indexed_vec.rs b/src/librustc_data_structures/indexed_vec.rs index 01fb2930687..82882f94440 100644 --- a/src/librustc_data_structures/indexed_vec.rs +++ b/src/librustc_data_structures/indexed_vec.rs @@ -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)] -- cgit 1.4.1-3-g733a5