55//! its name suggest, is to provide an abstraction boundary for creating
66//! interned Chalk types.
77
8- use chalk_ir:: { GoalData , Parameter } ;
9-
108use rustc_middle:: ty:: fold:: { TypeFoldable , TypeFolder , TypeVisitor } ;
119use rustc_middle:: ty:: { self , Ty , TyCtxt } ;
1210
@@ -79,16 +77,19 @@ impl fmt::Debug for RustInterner<'_> {
7977impl < ' tcx > chalk_ir:: interner:: Interner for RustInterner < ' tcx > {
8078 type InternedType = Box < chalk_ir:: TyData < Self > > ;
8179 type InternedLifetime = Box < chalk_ir:: LifetimeData < Self > > ;
82- type InternedParameter = Box < chalk_ir:: ParameterData < Self > > ;
80+ type InternedConst = Box < chalk_ir:: ConstData < Self > > ;
81+ type InternedConcreteConst = u32 ;
82+ type InternedGenericArg = Box < chalk_ir:: GenericArgData < Self > > ;
8383 type InternedGoal = Box < chalk_ir:: GoalData < Self > > ;
8484 type InternedGoals = Vec < chalk_ir:: Goal < Self > > ;
85- type InternedSubstitution = Vec < chalk_ir:: Parameter < Self > > ;
85+ type InternedSubstitution = Vec < chalk_ir:: GenericArg < Self > > ;
8686 type InternedProgramClause = Box < chalk_ir:: ProgramClauseData < Self > > ;
8787 type InternedProgramClauses = Vec < chalk_ir:: ProgramClause < Self > > ;
8888 type InternedQuantifiedWhereClauses = Vec < chalk_ir:: QuantifiedWhereClause < Self > > ;
89- type InternedParameterKinds = Vec < chalk_ir:: ParameterKind < ( ) > > ;
90- type InternedCanonicalVarKinds = Vec < chalk_ir:: ParameterKind < chalk_ir :: UniverseIndex > > ;
89+ type InternedVariableKinds = Vec < chalk_ir:: VariableKind < Self > > ;
90+ type InternedCanonicalVarKinds = Vec < chalk_ir:: CanonicalVarKind < Self > > ;
9191 type DefId = RustDefId ;
92+ type InternedAdtId = RustDefId ;
9293 type Identifier = ( ) ;
9394
9495 fn debug_program_clause_implication (
@@ -202,25 +203,39 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
202203 & lifetime
203204 }
204205
205- fn intern_parameter (
206+ fn intern_const ( & self , constant : chalk_ir:: ConstData < Self > ) -> Self :: InternedConst {
207+ Box :: new ( constant)
208+ }
209+
210+ fn const_data < ' a > ( & self , constant : & ' a Self :: InternedConst ) -> & ' a chalk_ir:: ConstData < Self > {
211+ & constant
212+ }
213+
214+ fn const_eq (
206215 & self ,
207- parameter : chalk_ir:: ParameterData < Self > ,
208- ) -> Self :: InternedParameter {
209- Box :: new ( parameter)
216+ _ty : & Self :: InternedType ,
217+ c1 : & Self :: InternedConcreteConst ,
218+ c2 : & Self :: InternedConcreteConst ,
219+ ) -> bool {
220+ c1 == c2
221+ }
222+
223+ fn intern_generic_arg ( & self , data : chalk_ir:: GenericArgData < Self > ) -> Self :: InternedGenericArg {
224+ Box :: new ( data)
210225 }
211226
212- fn parameter_data < ' a > (
227+ fn generic_arg_data < ' a > (
213228 & self ,
214- parameter : & ' a Self :: InternedParameter ,
215- ) -> & ' a chalk_ir:: ParameterData < Self > {
216- & parameter
229+ data : & ' a Self :: InternedGenericArg ,
230+ ) -> & ' a chalk_ir:: GenericArgData < Self > {
231+ & data
217232 }
218233
219- fn intern_goal ( & self , goal : GoalData < Self > ) -> Self :: InternedGoal {
234+ fn intern_goal ( & self , goal : chalk_ir :: GoalData < Self > ) -> Self :: InternedGoal {
220235 Box :: new ( goal)
221236 }
222237
223- fn goal_data < ' a > ( & self , goal : & ' a Self :: InternedGoal ) -> & ' a GoalData < Self > {
238+ fn goal_data < ' a > ( & self , goal : & ' a Self :: InternedGoal ) -> & ' a chalk_ir :: GoalData < Self > {
224239 & goal
225240 }
226241
@@ -237,15 +252,15 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
237252
238253 fn intern_substitution < E > (
239254 & self ,
240- data : impl IntoIterator < Item = Result < chalk_ir:: Parameter < Self > , E > > ,
255+ data : impl IntoIterator < Item = Result < chalk_ir:: GenericArg < Self > , E > > ,
241256 ) -> Result < Self :: InternedSubstitution , E > {
242257 data. into_iter ( ) . collect :: < Result < Vec < _ > , _ > > ( )
243258 }
244259
245260 fn substitution_data < ' a > (
246261 & self ,
247262 substitution : & ' a Self :: InternedSubstitution ,
248- ) -> & ' a [ Parameter < Self > ] {
263+ ) -> & ' a [ chalk_ir :: GenericArg < Self > ] {
249264 substitution
250265 }
251266
@@ -291,31 +306,31 @@ impl<'tcx> chalk_ir::interner::Interner for RustInterner<'tcx> {
291306 clauses
292307 }
293308
294- fn intern_parameter_kinds < E > (
309+ fn intern_generic_arg_kinds < E > (
295310 & self ,
296- data : impl IntoIterator < Item = Result < chalk_ir:: ParameterKind < ( ) > , E > > ,
297- ) -> Result < Self :: InternedParameterKinds , E > {
311+ data : impl IntoIterator < Item = Result < chalk_ir:: VariableKind < Self > , E > > ,
312+ ) -> Result < Self :: InternedVariableKinds , E > {
298313 data. into_iter ( ) . collect :: < Result < Vec < _ > , _ > > ( )
299314 }
300315
301- fn parameter_kinds_data < ' a > (
316+ fn variable_kinds_data < ' a > (
302317 & self ,
303- parameter_kinds : & ' a Self :: InternedParameterKinds ,
304- ) -> & ' a [ chalk_ir:: ParameterKind < ( ) > ] {
318+ parameter_kinds : & ' a Self :: InternedVariableKinds ,
319+ ) -> & ' a [ chalk_ir:: VariableKind < Self > ] {
305320 parameter_kinds
306321 }
307322
308323 fn intern_canonical_var_kinds < E > (
309324 & self ,
310- data : impl IntoIterator < Item = Result < chalk_ir:: ParameterKind < chalk_ir :: UniverseIndex > , E > > ,
325+ data : impl IntoIterator < Item = Result < chalk_ir:: CanonicalVarKind < Self > , E > > ,
311326 ) -> Result < Self :: InternedCanonicalVarKinds , E > {
312327 data. into_iter ( ) . collect :: < Result < Vec < _ > , _ > > ( )
313328 }
314329
315330 fn canonical_var_kinds_data < ' a > (
316331 & self ,
317332 canonical_var_kinds : & ' a Self :: InternedCanonicalVarKinds ,
318- ) -> & ' a [ chalk_ir:: ParameterKind < chalk_ir :: UniverseIndex > ] {
333+ ) -> & ' a [ chalk_ir:: CanonicalVarKind < Self > ] {
319334 canonical_var_kinds
320335 }
321336}
0 commit comments