@@ -59,53 +59,126 @@ impl chalk_ir::interner::Interner for Interner {
5959 None
6060 }
6161
62+ fn debug_ty ( _ty : & chalk_ir:: Ty < Self > , _fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
63+ None
64+ }
65+
66+ fn debug_lifetime (
67+ _lifetime : & chalk_ir:: Lifetime < Self > ,
68+ _fmt : & mut fmt:: Formatter < ' _ > ,
69+ ) -> Option < fmt:: Result > {
70+ None
71+ }
72+
73+ fn debug_parameter (
74+ _parameter : & Parameter < Self > ,
75+ _fmt : & mut fmt:: Formatter < ' _ > ,
76+ ) -> Option < fmt:: Result > {
77+ None
78+ }
79+
80+ fn debug_goal ( _goal : & Goal < Self > , _fmt : & mut fmt:: Formatter < ' _ > ) -> Option < fmt:: Result > {
81+ None
82+ }
83+
84+ fn debug_goals (
85+ _goals : & chalk_ir:: Goals < Self > ,
86+ _fmt : & mut fmt:: Formatter < ' _ > ,
87+ ) -> Option < fmt:: Result > {
88+ None
89+ }
90+
91+ fn debug_program_clause_implication (
92+ _pci : & chalk_ir:: ProgramClauseImplication < Self > ,
93+ _fmt : & mut fmt:: Formatter < ' _ > ,
94+ ) -> Option < fmt:: Result > {
95+ None
96+ }
97+
98+ fn debug_application_ty (
99+ _application_ty : & chalk_ir:: ApplicationTy < Self > ,
100+ _fmt : & mut fmt:: Formatter < ' _ > ,
101+ ) -> Option < fmt:: Result > {
102+ None
103+ }
104+
105+ fn debug_substitution (
106+ _substitution : & chalk_ir:: Substitution < Self > ,
107+ _fmt : & mut fmt:: Formatter < ' _ > ,
108+ ) -> Option < fmt:: Result > {
109+ None
110+ }
111+
112+ fn debug_separator_trait_ref (
113+ _separator_trait_ref : & chalk_ir:: SeparatorTraitRef < Self > ,
114+ _fmt : & mut fmt:: Formatter < ' _ > ,
115+ ) -> Option < fmt:: Result > {
116+ None
117+ }
118+
62119 fn intern_ty ( & self , ty : chalk_ir:: TyData < Self > ) -> Box < chalk_ir:: TyData < Self > > {
63120 Box :: new ( ty)
64121 }
65122
66- fn ty_data ( ty : & Box < chalk_ir:: TyData < Self > > ) -> & chalk_ir:: TyData < Self > {
123+ fn ty_data < ' a > ( & self , ty : & ' a Box < chalk_ir:: TyData < Self > > ) -> & ' a chalk_ir:: TyData < Self > {
67124 ty
68125 }
69126
70- fn intern_lifetime ( lifetime : chalk_ir:: LifetimeData < Self > ) -> chalk_ir:: LifetimeData < Self > {
127+ fn intern_lifetime (
128+ & self ,
129+ lifetime : chalk_ir:: LifetimeData < Self > ,
130+ ) -> chalk_ir:: LifetimeData < Self > {
71131 lifetime
72132 }
73133
74- fn lifetime_data ( lifetime : & chalk_ir:: LifetimeData < Self > ) -> & chalk_ir:: LifetimeData < Self > {
134+ fn lifetime_data < ' a > (
135+ & self ,
136+ lifetime : & ' a chalk_ir:: LifetimeData < Self > ,
137+ ) -> & ' a chalk_ir:: LifetimeData < Self > {
75138 lifetime
76139 }
77140
78- fn intern_parameter ( parameter : chalk_ir:: ParameterData < Self > ) -> chalk_ir:: ParameterData < Self > {
141+ fn intern_parameter (
142+ & self ,
143+ parameter : chalk_ir:: ParameterData < Self > ,
144+ ) -> chalk_ir:: ParameterData < Self > {
79145 parameter
80146 }
81147
82- fn parameter_data ( parameter : & chalk_ir:: ParameterData < Self > ) -> & chalk_ir:: ParameterData < Self > {
148+ fn parameter_data < ' a > (
149+ & self ,
150+ parameter : & ' a chalk_ir:: ParameterData < Self > ,
151+ ) -> & ' a chalk_ir:: ParameterData < Self > {
83152 parameter
84153 }
85154
86- fn intern_goal ( goal : GoalData < Self > ) -> Arc < GoalData < Self > > {
155+ fn intern_goal ( & self , goal : GoalData < Self > ) -> Arc < GoalData < Self > > {
87156 Arc :: new ( goal)
88157 }
89158
90- fn intern_goals ( data : impl IntoIterator < Item = Goal < Self > > ) -> Self :: InternedGoals {
159+ fn intern_goals ( & self , data : impl IntoIterator < Item = Goal < Self > > ) -> Self :: InternedGoals {
91160 data. into_iter ( ) . collect ( )
92161 }
93162
94- fn goal_data ( goal : & Arc < GoalData < Self > > ) -> & GoalData < Self > {
163+ fn goal_data < ' a > ( & self , goal : & ' a Arc < GoalData < Self > > ) -> & ' a GoalData < Self > {
95164 goal
96165 }
97166
98- fn goals_data ( goals : & Vec < Goal < Interner > > ) -> & [ Goal < Interner > ] {
167+ fn goals_data < ' a > ( & self , goals : & ' a Vec < Goal < Interner > > ) -> & ' a [ Goal < Interner > ] {
99168 goals
100169 }
101170
102171 fn intern_substitution < E > (
172+ & self ,
103173 data : impl IntoIterator < Item = Result < Parameter < Self > , E > > ,
104174 ) -> Result < Vec < Parameter < Self > > , E > {
105175 data. into_iter ( ) . collect ( )
106176 }
107177
108- fn substitution_data ( substitution : & Vec < Parameter < Self > > ) -> & [ Parameter < Self > ] {
178+ fn substitution_data < ' a > (
179+ & self ,
180+ substitution : & ' a Vec < Parameter < Self > > ,
181+ ) -> & ' a [ Parameter < Self > ] {
109182 substitution
110183 }
111184}
@@ -145,12 +218,14 @@ impl ToChalk for Ty {
145218 Ty :: Apply ( apply_ty) => {
146219 let name = apply_ty. ctor . to_chalk ( db) ;
147220 let substitution = apply_ty. parameters . to_chalk ( db) ;
148- chalk_ir:: ApplicationTy { name, substitution } . cast ( ) . intern ( & Interner )
221+ chalk_ir:: ApplicationTy { name, substitution } . cast ( & Interner ) . intern ( & Interner )
149222 }
150223 Ty :: Projection ( proj_ty) => {
151224 let associated_ty_id = proj_ty. associated_ty . to_chalk ( db) ;
152225 let substitution = proj_ty. parameters . to_chalk ( db) ;
153- chalk_ir:: AliasTy { associated_ty_id, substitution } . cast ( ) . intern ( & Interner )
226+ chalk_ir:: AliasTy { associated_ty_id, substitution }
227+ . cast ( & Interner )
228+ . intern ( & Interner )
154229 }
155230 Ty :: Placeholder ( id) => {
156231 let interned_id = db. intern_type_param_id ( id) ;
@@ -173,14 +248,14 @@ impl ToChalk for Ty {
173248 chalk_ir:: TyData :: Dyn ( bounded_ty) . intern ( & Interner )
174249 }
175250 Ty :: Opaque ( _) | Ty :: Unknown => {
176- let substitution = chalk_ir:: Substitution :: empty ( ) ;
251+ let substitution = chalk_ir:: Substitution :: empty ( & Interner ) ;
177252 let name = TypeName :: Error ;
178- chalk_ir:: ApplicationTy { name, substitution } . cast ( ) . intern ( & Interner )
253+ chalk_ir:: ApplicationTy { name, substitution } . cast ( & Interner ) . intern ( & Interner )
179254 }
180255 }
181256 }
182257 fn from_chalk ( db : & dyn HirDatabase , chalk : chalk_ir:: Ty < Interner > ) -> Self {
183- match chalk. data ( ) . clone ( ) {
258+ match chalk. data ( & Interner ) . clone ( ) {
184259 chalk_ir:: TyData :: Apply ( apply_ty) => match apply_ty. name {
185260 TypeName :: Error => Ty :: Unknown ,
186261 _ => {
@@ -218,13 +293,13 @@ impl ToChalk for Substs {
218293 type Chalk = chalk_ir:: Substitution < Interner > ;
219294
220295 fn to_chalk ( self , db : & dyn HirDatabase ) -> chalk_ir:: Substitution < Interner > {
221- chalk_ir:: Substitution :: from ( self . iter ( ) . map ( |ty| ty. clone ( ) . to_chalk ( db) ) )
296+ chalk_ir:: Substitution :: from ( & Interner , self . iter ( ) . map ( |ty| ty. clone ( ) . to_chalk ( db) ) )
222297 }
223298
224299 fn from_chalk ( db : & dyn HirDatabase , parameters : chalk_ir:: Substitution < Interner > ) -> Substs {
225300 let tys = parameters
226- . into_iter ( )
227- . map ( |p| match p. ty ( ) {
301+ . iter ( & Interner )
302+ . map ( |p| match p. ty ( & Interner ) {
228303 Some ( ty) => from_chalk ( db, ty. clone ( ) ) ,
229304 None => unimplemented ! ( ) ,
230305 } )
@@ -400,8 +475,8 @@ impl ToChalk for Obligation {
400475
401476 fn to_chalk ( self , db : & dyn HirDatabase ) -> chalk_ir:: DomainGoal < Interner > {
402477 match self {
403- Obligation :: Trait ( tr) => tr. to_chalk ( db) . cast ( ) ,
404- Obligation :: Projection ( pr) => pr. to_chalk ( db) . cast ( ) ,
478+ Obligation :: Trait ( tr) => tr. to_chalk ( db) . cast ( & Interner ) ,
479+ Obligation :: Projection ( pr) => pr. to_chalk ( db) . cast ( & Interner ) ,
405480 }
406481 }
407482
@@ -438,8 +513,8 @@ impl ToChalk for Arc<super::TraitEnvironment> {
438513 continue ;
439514 }
440515 let program_clause: chalk_ir:: ProgramClause < Interner > =
441- pred. clone ( ) . to_chalk ( db) . cast ( ) ;
442- clauses. push ( program_clause. into_from_env_clause ( ) ) ;
516+ pred. clone ( ) . to_chalk ( db) . cast ( & Interner ) ;
517+ clauses. push ( program_clause. into_from_env_clause ( & Interner ) ) ;
443518 }
444519 chalk_ir:: Environment :: new ( ) . add_clauses ( clauses)
445520 }
@@ -578,9 +653,9 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
578653 . map ( |impl_| impl_. to_chalk ( self . db ) )
579654 . collect ( ) ;
580655
581- let ty: Ty = from_chalk ( self . db , parameters[ 0 ] . assert_ty_ref ( ) . clone ( ) ) ;
656+ let ty: Ty = from_chalk ( self . db , parameters[ 0 ] . assert_ty_ref ( & Interner ) . clone ( ) ) ;
582657 let arg: Option < Ty > =
583- parameters. get ( 1 ) . map ( |p| from_chalk ( self . db , p. assert_ty_ref ( ) . clone ( ) ) ) ;
658+ parameters. get ( 1 ) . map ( |p| from_chalk ( self . db , p. assert_ty_ref ( & Interner ) . clone ( ) ) ) ;
584659
585660 builtin:: get_builtin_impls ( self . db , self . krate , & ty, & arg, trait_, |i| {
586661 result. push ( i. to_chalk ( self . db ) )
0 commit comments