mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-26 22:53:28 +00:00
Improve DefIndex formatting to be more semantic
This commit is contained in:
parent
088216fb99
commit
b8cf07ee1f
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user