@@ -15,7 +15,17 @@ impl<'tcx, T: fmt::Debug> fmt::Debug for Normalized<'tcx, T> {
15
15
}
16
16
}
17
17
18
- impl < ' tcx , O : fmt:: Debug > fmt:: Debug for traits:: Obligation < ' tcx , O > {
18
+ impl < ' tcx , T : fmt:: Display > fmt:: Display for Normalized < ' tcx , T > {
19
+ fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
20
+ write ! ( f, "{}" , self . value) ?;
21
+ if !self . obligations . is_empty ( ) {
22
+ write ! ( f, " @ obligations={:?}" , self . obligations) ?;
23
+ }
24
+ Ok ( ( ) )
25
+ }
26
+ }
27
+
28
+ impl < ' tcx , O : fmt:: Debug + fmt:: Display > fmt:: Debug for traits:: Obligation < ' tcx , O > {
19
29
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
20
30
if ty:: tls:: with ( |tcx| tcx. sess . verbose ( ) ) {
21
31
write ! (
@@ -24,7 +34,11 @@ impl<'tcx, O: fmt::Debug> fmt::Debug for traits::Obligation<'tcx, O> {
24
34
self . predicate, self . cause, self . param_env, self . recursion_depth
25
35
)
26
36
} else {
27
- write ! ( f, "Obligation(predicate={:?}, depth={})" , self . predicate, self . recursion_depth)
37
+ write ! ( f, "{}" , self . predicate) ?;
38
+ if self . recursion_depth > 0 {
39
+ write ! ( f, " @ depth={}" , self . recursion_depth) ?;
40
+ }
41
+ Ok ( ( ) )
28
42
}
29
43
}
30
44
}
@@ -60,7 +74,9 @@ impl<'tcx> fmt::Debug for traits::MismatchedProjectionTypes<'tcx> {
60
74
///////////////////////////////////////////////////////////////////////////
61
75
// TypeFoldable implementations.
62
76
63
- impl < ' tcx , O : TypeFoldable < ' tcx > > TypeFoldable < ' tcx > for traits:: Obligation < ' tcx , O > {
77
+ impl < ' tcx , O : TypeFoldable < ' tcx > + fmt:: Display > TypeFoldable < ' tcx >
78
+ for traits:: Obligation < ' tcx , O >
79
+ {
64
80
fn try_fold_with < F : FallibleTypeFolder < ' tcx > > ( self , folder : & mut F ) -> Result < Self , F :: Error > {
65
81
Ok ( traits:: Obligation {
66
82
cause : self . cause ,
@@ -71,7 +87,9 @@ impl<'tcx, O: TypeFoldable<'tcx>> TypeFoldable<'tcx> for traits::Obligation<'tcx
71
87
}
72
88
}
73
89
74
- impl < ' tcx , O : TypeVisitable < ' tcx > > TypeVisitable < ' tcx > for traits:: Obligation < ' tcx , O > {
90
+ impl < ' tcx , O : TypeVisitable < ' tcx > + fmt:: Display > TypeVisitable < ' tcx >
91
+ for traits:: Obligation < ' tcx , O >
92
+ {
75
93
fn visit_with < V : TypeVisitor < ' tcx > > ( & self , visitor : & mut V ) -> ControlFlow < V :: BreakTy > {
76
94
self . predicate . visit_with ( visitor) ?;
77
95
self . param_env . visit_with ( visitor)
0 commit comments