Skip to content

Commit 453f236

Browse files
Merge #8351
8351: Use more assoc. type aliases in the chalk interner r=flodiebold a=jonas-schievink Makes it sligthly easier to swap out these types Co-authored-by: Jonas Schievink <[email protected]>
2 parents 87e56eb + f48dd15 commit 453f236

File tree

1 file changed

+21
-22
lines changed

1 file changed

+21
-22
lines changed

crates/hir_ty/src/traits/chalk/interner.rs

Lines changed: 21 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -192,59 +192,58 @@ impl chalk_ir::interner::Interner for Interner {
192192
tls::with_current_program(|prog| Some(prog?.debug_quantified_where_clauses(clauses, fmt)))
193193
}
194194

195-
fn intern_ty(&self, kind: chalk_ir::TyKind<Self>) -> Arc<chalk_ir::TyData<Self>> {
195+
fn intern_ty(&self, kind: chalk_ir::TyKind<Self>) -> Self::InternedType {
196196
let flags = kind.compute_flags(self);
197197
Arc::new(chalk_ir::TyData { kind, flags })
198198
}
199199

200-
fn ty_data<'a>(&self, ty: &'a Arc<chalk_ir::TyData<Self>>) -> &'a chalk_ir::TyData<Self> {
200+
fn ty_data<'a>(&self, ty: &'a Self::InternedType) -> &'a chalk_ir::TyData<Self> {
201201
ty
202202
}
203203

204-
fn intern_lifetime(
205-
&self,
206-
lifetime: chalk_ir::LifetimeData<Self>,
207-
) -> chalk_ir::LifetimeData<Self> {
204+
fn intern_lifetime(&self, lifetime: chalk_ir::LifetimeData<Self>) -> Self::InternedLifetime {
208205
lifetime
209206
}
210207

211208
fn lifetime_data<'a>(
212209
&self,
213-
lifetime: &'a chalk_ir::LifetimeData<Self>,
210+
lifetime: &'a Self::InternedLifetime,
214211
) -> &'a chalk_ir::LifetimeData<Self> {
215212
lifetime
216213
}
217214

218-
fn intern_const(&self, constant: chalk_ir::ConstData<Self>) -> Arc<chalk_ir::ConstData<Self>> {
215+
fn intern_const(&self, constant: chalk_ir::ConstData<Self>) -> Self::InternedConst {
219216
Arc::new(constant)
220217
}
221218

222-
fn const_data<'a>(
223-
&self,
224-
constant: &'a Arc<chalk_ir::ConstData<Self>>,
225-
) -> &'a chalk_ir::ConstData<Self> {
219+
fn const_data<'a>(&self, constant: &'a Self::InternedConst) -> &'a chalk_ir::ConstData<Self> {
226220
constant
227221
}
228222

229-
fn const_eq(&self, _ty: &Arc<chalk_ir::TyData<Self>>, _c1: &(), _c2: &()) -> bool {
223+
fn const_eq(
224+
&self,
225+
_ty: &Self::InternedType,
226+
_c1: &Self::InternedConcreteConst,
227+
_c2: &Self::InternedConcreteConst,
228+
) -> bool {
230229
true
231230
}
232231

233232
fn intern_generic_arg(
234233
&self,
235234
parameter: chalk_ir::GenericArgData<Self>,
236-
) -> chalk_ir::GenericArgData<Self> {
235+
) -> Self::InternedGenericArg {
237236
parameter
238237
}
239238

240239
fn generic_arg_data<'a>(
241240
&self,
242-
parameter: &'a chalk_ir::GenericArgData<Self>,
241+
parameter: &'a Self::InternedGenericArg,
243242
) -> &'a chalk_ir::GenericArgData<Self> {
244243
parameter
245244
}
246245

247-
fn intern_goal(&self, goal: GoalData<Self>) -> Arc<GoalData<Self>> {
246+
fn intern_goal(&self, goal: GoalData<Self>) -> Self::InternedGoal {
248247
Arc::new(goal)
249248
}
250249

@@ -255,11 +254,11 @@ impl chalk_ir::interner::Interner for Interner {
255254
data.into_iter().collect()
256255
}
257256

258-
fn goal_data<'a>(&self, goal: &'a Arc<GoalData<Self>>) -> &'a GoalData<Self> {
257+
fn goal_data<'a>(&self, goal: &'a Self::InternedGoal) -> &'a GoalData<Self> {
259258
goal
260259
}
261260

262-
fn goals_data<'a>(&self, goals: &'a Vec<Goal<Interner>>) -> &'a [Goal<Interner>] {
261+
fn goals_data<'a>(&self, goals: &'a Self::InternedGoals) -> &'a [Goal<Interner>] {
263262
goals
264263
}
265264

@@ -280,27 +279,27 @@ impl chalk_ir::interner::Interner for Interner {
280279
fn intern_program_clause(
281280
&self,
282281
data: chalk_ir::ProgramClauseData<Self>,
283-
) -> Arc<chalk_ir::ProgramClauseData<Self>> {
282+
) -> Self::InternedProgramClause {
284283
Arc::new(data)
285284
}
286285

287286
fn program_clause_data<'a>(
288287
&self,
289-
clause: &'a Arc<chalk_ir::ProgramClauseData<Self>>,
288+
clause: &'a Self::InternedProgramClause,
290289
) -> &'a chalk_ir::ProgramClauseData<Self> {
291290
clause
292291
}
293292

294293
fn intern_program_clauses<E>(
295294
&self,
296295
data: impl IntoIterator<Item = Result<chalk_ir::ProgramClause<Self>, E>>,
297-
) -> Result<Arc<[chalk_ir::ProgramClause<Self>]>, E> {
296+
) -> Result<Self::InternedProgramClauses, E> {
298297
data.into_iter().collect()
299298
}
300299

301300
fn program_clauses_data<'a>(
302301
&self,
303-
clauses: &'a Arc<[chalk_ir::ProgramClause<Self>]>,
302+
clauses: &'a Self::InternedProgramClauses,
304303
) -> &'a [chalk_ir::ProgramClause<Self>] {
305304
&clauses
306305
}

0 commit comments

Comments
 (0)