Skip to content

Commit f6fd754

Browse files
Printing alias-relate goals correctly
1 parent 3a36a09 commit f6fd754

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

compiler/rustc_middle/src/ty/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,16 @@ impl AliasRelationDirection {
661661
}
662662
}
663663

664+
impl std::fmt::Display for AliasRelationDirection {
665+
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
666+
match self {
667+
AliasRelationDirection::Equate => write!(f, " == "),
668+
AliasRelationDirection::Subtype => write!(f, " <: "),
669+
AliasRelationDirection::Supertype => write!(f, " :> "),
670+
}
671+
}
672+
}
673+
664674
/// The crate outlives map is computed during typeck and contains the
665675
/// outlives of every item in the local crate. You should not use it
666676
/// directly, because to do so will make your pass dependent on the

compiler/rustc_middle/src/ty/print/pretty.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2847,8 +2847,7 @@ define_print_and_forward_display! {
28472847
p!("the type `", print(ty), "` is found in the environment")
28482848
}
28492849
ty::PredicateKind::Ambiguous => p!("ambiguous"),
2850-
// TODO
2851-
ty::PredicateKind::AliasRelate(t1, t2, _) => p!(print(t1), " == ", print(t2)),
2850+
ty::PredicateKind::AliasRelate(t1, t2, dir) => p!(print(t1), write(" {} ", dir), print(t2)),
28522851
}
28532852
}
28542853

compiler/rustc_middle/src/ty/structural_impls.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -177,8 +177,9 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> {
177177
write!(f, "TypeWellFormedFromEnv({:?})", ty)
178178
}
179179
ty::PredicateKind::Ambiguous => write!(f, "Ambiguous"),
180-
// TODO
181-
ty::PredicateKind::AliasRelate(t1, t2, _) => write!(f, "AliasRelate({t1:?}, {t2:?})"),
180+
ty::PredicateKind::AliasRelate(t1, t2, dir) => {
181+
write!(f, "AliasRelate({t1:?}, {dir:?}, {t2:?})")
182+
}
182183
}
183184
}
184185
}

0 commit comments

Comments
 (0)