diff options
| author | Michael Goulet <michael@errs.io> | 2023-03-21 22:20:54 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-03-23 05:56:40 +0000 |
| commit | f6fd7546804dd25d4996196dbc9653bde2b4a131 (patch) | |
| tree | 6baebcb04a04adc4f2f2c1c41bdd996800415a7c | |
| parent | 3a36a093ddb1c117247a8154970d5f8a5782da87 (diff) | |
| download | rust-f6fd7546804dd25d4996196dbc9653bde2b4a131.tar.gz rust-f6fd7546804dd25d4996196dbc9653bde2b4a131.zip | |
Printing alias-relate goals correctly
| -rw-r--r-- | compiler/rustc_middle/src/ty/mod.rs | 10 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/print/pretty.rs | 3 | ||||
| -rw-r--r-- | compiler/rustc_middle/src/ty/structural_impls.rs | 5 |
3 files changed, 14 insertions, 4 deletions
diff --git a/compiler/rustc_middle/src/ty/mod.rs b/compiler/rustc_middle/src/ty/mod.rs index 4ab3df917e3..23139e6be7a 100644 --- a/compiler/rustc_middle/src/ty/mod.rs +++ b/compiler/rustc_middle/src/ty/mod.rs @@ -661,6 +661,16 @@ impl AliasRelationDirection { } } +impl std::fmt::Display for AliasRelationDirection { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + match self { + AliasRelationDirection::Equate => write!(f, " == "), + AliasRelationDirection::Subtype => write!(f, " <: "), + AliasRelationDirection::Supertype => write!(f, " :> "), + } + } +} + /// The crate outlives map is computed during typeck and contains the /// outlives of every item in the local crate. You should not use it /// directly, because to do so will make your pass dependent on the diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs index ad5c9d93b47..e9f8f2e5865 100644 --- a/compiler/rustc_middle/src/ty/print/pretty.rs +++ b/compiler/rustc_middle/src/ty/print/pretty.rs @@ -2847,8 +2847,7 @@ define_print_and_forward_display! { p!("the type `", print(ty), "` is found in the environment") } ty::PredicateKind::Ambiguous => p!("ambiguous"), - // TODO - ty::PredicateKind::AliasRelate(t1, t2, _) => p!(print(t1), " == ", print(t2)), + ty::PredicateKind::AliasRelate(t1, t2, dir) => p!(print(t1), write(" {} ", dir), print(t2)), } } diff --git a/compiler/rustc_middle/src/ty/structural_impls.rs b/compiler/rustc_middle/src/ty/structural_impls.rs index ad5f33d34dc..c6bb8146795 100644 --- a/compiler/rustc_middle/src/ty/structural_impls.rs +++ b/compiler/rustc_middle/src/ty/structural_impls.rs @@ -177,8 +177,9 @@ impl<'tcx> fmt::Debug for ty::PredicateKind<'tcx> { write!(f, "TypeWellFormedFromEnv({:?})", ty) } ty::PredicateKind::Ambiguous => write!(f, "Ambiguous"), - // TODO - ty::PredicateKind::AliasRelate(t1, t2, _) => write!(f, "AliasRelate({t1:?}, {t2:?})"), + ty::PredicateKind::AliasRelate(t1, t2, dir) => { + write!(f, "AliasRelate({t1:?}, {dir:?}, {t2:?})") + } } } } |
