Skip to content

Commit

Permalink
Improve DefIndex formatting to be more semantic
Browse files Browse the repository at this point in the history
  • Loading branch information
est31 committed Sep 4, 2017
1 parent 088216f commit b8cf07e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/librustc/hir/def_id.rs
Expand Up @@ -93,10 +93,19 @@ impl serialize::UseSpecializedDecodable for CrateNum {
///
/// Since the DefIndex is mostly treated as an opaque ID, you probably
/// don't have to care about these ranges.
#[derive(Clone, Debug, Eq, Ord, PartialOrd, PartialEq, RustcEncodable,
#[derive(Clone, Eq, Ord, PartialOrd, PartialEq, RustcEncodable,
RustcDecodable, Hash, Copy)]
pub struct DefIndex(u32);

impl fmt::Debug for DefIndex {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,
"DefIndex({}:{})",
self.address_space().index(),
self.as_array_index())
}
}

impl DefIndex {
#[inline]
pub fn new(x: usize) -> DefIndex {
Expand Down

0 comments on commit b8cf07e

Please sign in to comment.