1
Fork 0

implement debug in similar way to RangeInclusive

This commit is contained in:
Andreas Liljeqvist 2021-08-23 15:05:40 +02:00
parent e8e6d9bd86
commit d230b92ba7
6 changed files with 49 additions and 159 deletions

View file

@ -688,7 +688,7 @@ impl Primitive {
///
/// This is intended specifically to mirror LLVMs `!range` metadata,
/// semantics.
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(Clone, PartialEq, Eq, Hash)]
#[derive(HashStable_Generic)]
pub struct WrappingRange {
pub start: u128,
@ -714,6 +714,13 @@ impl WrappingRange {
}
}
impl fmt::Debug for WrappingRange {
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "{}..={}", self.start, self.end)?;
Ok(())
}
}
/// Information about one scalar component of a Rust type.
#[derive(Clone, PartialEq, Eq, Hash, Debug)]
#[derive(HashStable_Generic)]