aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/traits/chalk
diff options
context:
space:
mode:
authorJonas Schievink <[email protected]>2021-04-05 19:15:07 +0100
committerJonas Schievink <[email protected]>2021-04-05 19:15:07 +0100
commitf48dd154a588b44568dcba9f50983c0578837f04 (patch)
treea51551137dbd8d81d49d2d2d085bfc5ef6664e49 /crates/hir_ty/src/traits/chalk
parentc91b5376835ab54cd4bca02953625ef1f1fabeba (diff)
Use more assoc. type aliases in the chalk interner
Makes it sligthly easier to swap out these types
Diffstat (limited to 'crates/hir_ty/src/traits/chalk')
-rw-r--r--crates/hir_ty/src/traits/chalk/interner.rs43
1 files changed, 21 insertions, 22 deletions
diff --git a/crates/hir_ty/src/traits/chalk/interner.rs b/crates/hir_ty/src/traits/chalk/interner.rs
index 94e94a26d..bd9395b7e 100644
--- a/crates/hir_ty/src/traits/chalk/interner.rs
+++ b/crates/hir_ty/src/traits/chalk/interner.rs
@@ -192,59 +192,58 @@ impl chalk_ir::interner::Interner for Interner {
192 tls::with_current_program(|prog| Some(prog?.debug_quantified_where_clauses(clauses, fmt))) 192 tls::with_current_program(|prog| Some(prog?.debug_quantified_where_clauses(clauses, fmt)))
193 } 193 }
194 194
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 {
196 let flags = kind.compute_flags(self); 196 let flags = kind.compute_flags(self);
197 Arc::new(chalk_ir::TyData { kind, flags }) 197 Arc::new(chalk_ir::TyData { kind, flags })
198 } 198 }
199 199
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> {
201 ty 201 ty
202 } 202 }
203 203
204 fn intern_lifetime( 204 fn intern_lifetime(&self, lifetime: chalk_ir::LifetimeData<Self>) -> Self::InternedLifetime {
205 &self,
206 lifetime: chalk_ir::LifetimeData<Self>,
207 ) -> chalk_ir::LifetimeData<Self> {
208 lifetime 205 lifetime
209 } 206 }
210 207
211 fn lifetime_data<'a>( 208 fn lifetime_data<'a>(
212 &self, 209 &self,
213 lifetime: &'a chalk_ir::LifetimeData<Self>, 210 lifetime: &'a Self::InternedLifetime,
214 ) -> &'a chalk_ir::LifetimeData<Self> { 211 ) -> &'a chalk_ir::LifetimeData<Self> {
215 lifetime 212 lifetime
216 } 213 }
217 214
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 {
219 Arc::new(constant) 216 Arc::new(constant)
220 } 217 }
221 218
222 fn const_data<'a>( 219 fn const_data<'a>(&self, constant: &'a Self::InternedConst) -> &'a chalk_ir::ConstData<Self> {
223 &self,
224 constant: &'a Arc<chalk_ir::ConstData<Self>>,
225 ) -> &'a chalk_ir::ConstData<Self> {
226 constant 220 constant
227 } 221 }
228 222
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 {
230 true 229 true
231 } 230 }
232 231
233 fn intern_generic_arg( 232 fn intern_generic_arg(
234 &self, 233 &self,
235 parameter: chalk_ir::GenericArgData<Self>, 234 parameter: chalk_ir::GenericArgData<Self>,
236 ) -> chalk_ir::GenericArgData<Self> { 235 ) -> Self::InternedGenericArg {
237 parameter 236 parameter
238 } 237 }
239 238
240 fn generic_arg_data<'a>( 239 fn generic_arg_data<'a>(
241 &self, 240 &self,
242 parameter: &'a chalk_ir::GenericArgData<Self>, 241 parameter: &'a Self::InternedGenericArg,
243 ) -> &'a chalk_ir::GenericArgData<Self> { 242 ) -> &'a chalk_ir::GenericArgData<Self> {
244 parameter 243 parameter
245 } 244 }
246 245
247 fn intern_goal(&self, goal: GoalData<Self>) -> Arc<GoalData<Self>> { 246 fn intern_goal(&self, goal: GoalData<Self>) -> Self::InternedGoal {
248 Arc::new(goal) 247 Arc::new(goal)
249 } 248 }
250 249
@@ -255,11 +254,11 @@ impl chalk_ir::interner::Interner for Interner {
255 data.into_iter().collect() 254 data.into_iter().collect()
256 } 255 }
257 256
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> {
259 goal 258 goal
260 } 259 }
261 260
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>] {
263 goals 262 goals
264 } 263 }
265 264
@@ -280,13 +279,13 @@ impl chalk_ir::interner::Interner for Interner {
280 fn intern_program_clause( 279 fn intern_program_clause(
281 &self, 280 &self,
282 data: chalk_ir::ProgramClauseData<Self>, 281 data: chalk_ir::ProgramClauseData<Self>,
283 ) -> Arc<chalk_ir::ProgramClauseData<Self>> { 282 ) -> Self::InternedProgramClause {
284 Arc::new(data) 283 Arc::new(data)
285 } 284 }
286 285
287 fn program_clause_data<'a>( 286 fn program_clause_data<'a>(
288 &self, 287 &self,
289 clause: &'a Arc<chalk_ir::ProgramClauseData<Self>>, 288 clause: &'a Self::InternedProgramClause,
290 ) -> &'a chalk_ir::ProgramClauseData<Self> { 289 ) -> &'a chalk_ir::ProgramClauseData<Self> {
291 clause 290 clause
292 } 291 }
@@ -294,13 +293,13 @@ impl chalk_ir::interner::Interner for Interner {
294 fn intern_program_clauses<E>( 293 fn intern_program_clauses<E>(
295 &self, 294 &self,
296 data: impl IntoIterator<Item = Result<chalk_ir::ProgramClause<Self>, E>>, 295 data: impl IntoIterator<Item = Result<chalk_ir::ProgramClause<Self>, E>>,
297 ) -> Result<Arc<[chalk_ir::ProgramClause<Self>]>, E> { 296 ) -> Result<Self::InternedProgramClauses, E> {
298 data.into_iter().collect() 297 data.into_iter().collect()
299 } 298 }
300 299
301 fn program_clauses_data<'a>( 300 fn program_clauses_data<'a>(
302 &self, 301 &self,
303 clauses: &'a Arc<[chalk_ir::ProgramClause<Self>]>, 302 clauses: &'a Self::InternedProgramClauses,
304 ) -> &'a [chalk_ir::ProgramClause<Self>] { 303 ) -> &'a [chalk_ir::ProgramClause<Self>] {
305 &clauses 304 &clauses
306 } 305 }