Skip to content

Commit e7a16df

Browse files
authored
Merge pull request #143 from scalexm/wf-debug
Correctly implement `Debug` for `FromEnv` and `WellFormed`
2 parents d67e569 + 25866e8 commit e7a16df

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/ir.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -619,7 +619,7 @@ pub struct Derefs {
619619
pub target: Ty,
620620
}
621621

622-
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
622+
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
623623
pub enum WellFormed {
624624
/// A predicate which is true is some trait ref is well-formed.
625625
/// For example, given the following trait definitions:
@@ -646,7 +646,7 @@ pub enum WellFormed {
646646
Ty(Ty),
647647
}
648648

649-
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug)]
649+
#[derive(Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
650650
pub enum FromEnv {
651651
/// A predicate which enables deriving everything which should be true if we *know* that
652652
/// some trait ref is well-formed. For example given the above trait definitions, we can use

src/ir/debug.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,24 @@ impl Debug for WhereClause {
184184
}
185185
}
186186

187+
impl Debug for FromEnv {
188+
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
189+
match self {
190+
FromEnv::Trait(t) => write!(fmt, "FromEnv({:?})", t),
191+
FromEnv::Ty(t) => write!(fmt, "FromEnv({:?})", t),
192+
}
193+
}
194+
}
195+
196+
impl Debug for WellFormed {
197+
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
198+
match self {
199+
WellFormed::Trait(t) => write!(fmt, "WellFormed({:?})", t),
200+
WellFormed::Ty(t) => write!(fmt, "WellFormed({:?})", t),
201+
}
202+
}
203+
}
204+
187205
impl Debug for DomainGoal {
188206
fn fmt(&self, fmt: &mut Formatter) -> Result<(), Error> {
189207
match self {

0 commit comments

Comments
 (0)