@@ -72,6 +72,7 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
72
72
type InternedQuantifiedWhereClauses = Vec < chalk_ir:: QuantifiedWhereClause < Self > > ;
73
73
type InternedVariableKinds = Vec < chalk_ir:: VariableKind < Self > > ;
74
74
type InternedCanonicalVarKinds = Vec < chalk_ir:: CanonicalVarKind < Self > > ;
75
+ type InternedVariances = Vec < chalk_ir:: Variance > ;
75
76
type InternedConstraints = Vec < chalk_ir:: InEnvironment < chalk_ir:: Constraint < Self > > > ;
76
77
type DefId = DefId ;
77
78
type InternedAdtId = & ' tcx AdtDef ;
@@ -86,17 +87,34 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
86
87
write ! ( fmt, "{:?}" , pci. consequence) ?;
87
88
88
89
let conditions = pci. conditions . interned ( ) ;
90
+ let constraints = pci. constraints . interned ( ) ;
89
91
90
92
let conds = conditions. len ( ) ;
91
- if conds == 0 {
93
+ let consts = constraints. len ( ) ;
94
+ if conds == 0 && consts == 0 {
92
95
return Ok ( ( ) ) ;
93
96
}
94
97
95
98
write ! ( fmt, " :- " ) ?;
96
- for cond in & conditions[ ..conds - 1 ] {
97
- write ! ( fmt, "{:?}, " , cond) ?;
99
+
100
+ if conds != 0 {
101
+ for cond in & conditions[ ..conds - 1 ] {
102
+ write ! ( fmt, "{:?}, " , cond) ?;
103
+ }
104
+ write ! ( fmt, "{:?}" , conditions[ conds - 1 ] ) ?;
105
+ }
106
+
107
+ if conds != 0 && consts != 0 {
108
+ write ! ( fmt, " ; " ) ?;
98
109
}
99
- write ! ( fmt, "{:?}" , conditions[ conds - 1 ] ) ?;
110
+
111
+ if consts != 0 {
112
+ for constraint in & constraints[ ..consts - 1 ] {
113
+ write ! ( fmt, "{:?}, " , constraint) ?;
114
+ }
115
+ write ! ( fmt, "{:?}" , constraints[ consts - 1 ] ) ?;
116
+ }
117
+
100
118
Ok ( ( ) )
101
119
} ;
102
120
Some ( write ( ) )
@@ -351,6 +369,20 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
351
369
) -> & ' a [ chalk_ir:: InEnvironment < chalk_ir:: Constraint < Self > > ] {
352
370
constraints
353
371
}
372
+
373
+ fn intern_variances < E > (
374
+ & self ,
375
+ data : impl IntoIterator < Item = Result < chalk_ir:: Variance , E > > ,
376
+ ) -> Result < Self :: InternedVariances , E > {
377
+ data. into_iter ( ) . collect :: < Result < Vec < _ > , _ > > ( )
378
+ }
379
+
380
+ fn variances_data < ' a > (
381
+ & self ,
382
+ variances : & ' a Self :: InternedVariances ,
383
+ ) -> & ' a [ chalk_ir:: Variance ] {
384
+ variances
385
+ }
354
386
}
355
387
356
388
impl < ' tcx > chalk_ir:: interner:: HasInterner for RustInterner < ' tcx > {
0 commit comments