aboutsummaryrefslogtreecommitdiff
path: root/crates/hir_ty/src/traits
diff options
context:
space:
mode:
Diffstat (limited to 'crates/hir_ty/src/traits')
-rw-r--r--crates/hir_ty/src/traits/chalk.rs4
-rw-r--r--crates/hir_ty/src/traits/chalk/mapping.rs22
2 files changed, 13 insertions, 13 deletions
diff --git a/crates/hir_ty/src/traits/chalk.rs b/crates/hir_ty/src/traits/chalk.rs
index ef1e6b2df..232cf9cd0 100644
--- a/crates/hir_ty/src/traits/chalk.rs
+++ b/crates/hir_ty/src/traits/chalk.rs
@@ -234,9 +234,9 @@ impl<'a> chalk_solve::RustIrDatabase<Interner> for ChalkContext<'a> {
234 ty: TyKind::BoundVar(BoundVar { debruijn: DebruijnIndex::ONE, index: 0 }) 234 ty: TyKind::BoundVar(BoundVar { debruijn: DebruijnIndex::ONE, index: 0 })
235 .intern(&Interner), 235 .intern(&Interner),
236 projection_ty: ProjectionTy { 236 projection_ty: ProjectionTy {
237 associated_ty: to_assoc_type_id(future_output), 237 associated_ty_id: to_assoc_type_id(future_output),
238 // Self type as the first parameter. 238 // Self type as the first parameter.
239 parameters: Substs::single( 239 substitution: Substs::single(
240 TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0)) 240 TyKind::BoundVar(BoundVar::new(DebruijnIndex::INNERMOST, 0))
241 .intern(&Interner), 241 .intern(&Interner),
242 ), 242 ),
diff --git a/crates/hir_ty/src/traits/chalk/mapping.rs b/crates/hir_ty/src/traits/chalk/mapping.rs
index 2a66a2310..68effbbf3 100644
--- a/crates/hir_ty/src/traits/chalk/mapping.rs
+++ b/crates/hir_ty/src/traits/chalk/mapping.rs
@@ -78,8 +78,8 @@ impl ToChalk for Ty {
78 chalk_ir::TyKind::Adt(adt_id, substitution).intern(&Interner) 78 chalk_ir::TyKind::Adt(adt_id, substitution).intern(&Interner)
79 } 79 }
80 TyKind::Alias(AliasTy::Projection(proj_ty)) => { 80 TyKind::Alias(AliasTy::Projection(proj_ty)) => {
81 let associated_ty_id = proj_ty.associated_ty; 81 let associated_ty_id = proj_ty.associated_ty_id;
82 let substitution = proj_ty.parameters.to_chalk(db); 82 let substitution = proj_ty.substitution.to_chalk(db);
83 chalk_ir::AliasTy::Projection(chalk_ir::ProjectionTy { 83 chalk_ir::AliasTy::Projection(chalk_ir::ProjectionTy {
84 associated_ty_id, 84 associated_ty_id,
85 substitution, 85 substitution,
@@ -121,7 +121,7 @@ impl ToChalk for Ty {
121 chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Projection(proj)) => { 121 chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Projection(proj)) => {
122 let associated_ty = proj.associated_ty_id; 122 let associated_ty = proj.associated_ty_id;
123 let parameters = from_chalk(db, proj.substitution); 123 let parameters = from_chalk(db, proj.substitution);
124 TyKind::Alias(AliasTy::Projection(ProjectionTy { associated_ty, parameters })) 124 TyKind::Alias(AliasTy::Projection(ProjectionTy { associated_ty_id: associated_ty, substitution: parameters }))
125 } 125 }
126 chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Opaque(opaque_ty)) => { 126 chalk_ir::TyKind::Alias(chalk_ir::AliasTy::Opaque(opaque_ty)) => {
127 let opaque_ty_id = opaque_ty.opaque_ty_id; 127 let opaque_ty_id = opaque_ty.opaque_ty_id;
@@ -372,8 +372,8 @@ impl ToChalk for ProjectionTy {
372 372
373 fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::ProjectionTy<Interner> { 373 fn to_chalk(self, db: &dyn HirDatabase) -> chalk_ir::ProjectionTy<Interner> {
374 chalk_ir::ProjectionTy { 374 chalk_ir::ProjectionTy {
375 associated_ty_id: self.associated_ty, 375 associated_ty_id: self.associated_ty_id,
376 substitution: self.parameters.to_chalk(db), 376 substitution: self.substitution.to_chalk(db),
377 } 377 }
378 } 378 }
379 379
@@ -382,8 +382,8 @@ impl ToChalk for ProjectionTy {
382 projection_ty: chalk_ir::ProjectionTy<Interner>, 382 projection_ty: chalk_ir::ProjectionTy<Interner>,
383 ) -> ProjectionTy { 383 ) -> ProjectionTy {
384 ProjectionTy { 384 ProjectionTy {
385 associated_ty: projection_ty.associated_ty_id, 385 associated_ty_id: projection_ty.associated_ty_id,
386 parameters: from_chalk(db, projection_ty.substitution), 386 substitution: from_chalk(db, projection_ty.substitution),
387 } 387 }
388 } 388 }
389} 389}
@@ -533,24 +533,24 @@ pub(super) fn generic_predicate_to_inline_bound(
533 Some(rust_ir::InlineBound::TraitBound(trait_bound)) 533 Some(rust_ir::InlineBound::TraitBound(trait_bound))
534 } 534 }
535 GenericPredicate::Projection(proj) => { 535 GenericPredicate::Projection(proj) => {
536 if &proj.projection_ty.parameters[0] != self_ty { 536 if &proj.projection_ty.substitution[0] != self_ty {
537 return None; 537 return None;
538 } 538 }
539 let trait_ = match from_assoc_type_id(proj.projection_ty.associated_ty) 539 let trait_ = match from_assoc_type_id(proj.projection_ty.associated_ty_id)
540 .lookup(db.upcast()) 540 .lookup(db.upcast())
541 .container 541 .container
542 { 542 {
543 AssocContainerId::TraitId(t) => t, 543 AssocContainerId::TraitId(t) => t,
544 _ => panic!("associated type not in trait"), 544 _ => panic!("associated type not in trait"),
545 }; 545 };
546 let args_no_self = proj.projection_ty.parameters[1..] 546 let args_no_self = proj.projection_ty.substitution[1..]
547 .iter() 547 .iter()
548 .map(|ty| ty.clone().to_chalk(db).cast(&Interner)) 548 .map(|ty| ty.clone().to_chalk(db).cast(&Interner))
549 .collect(); 549 .collect();
550 let alias_eq_bound = rust_ir::AliasEqBound { 550 let alias_eq_bound = rust_ir::AliasEqBound {
551 value: proj.ty.clone().to_chalk(db), 551 value: proj.ty.clone().to_chalk(db),
552 trait_bound: rust_ir::TraitBound { trait_id: trait_.to_chalk(db), args_no_self }, 552 trait_bound: rust_ir::TraitBound { trait_id: trait_.to_chalk(db), args_no_self },
553 associated_ty_id: proj.projection_ty.associated_ty, 553 associated_ty_id: proj.projection_ty.associated_ty_id,
554 parameters: Vec::new(), // FIXME we don't support generic associated types yet 554 parameters: Vec::new(), // FIXME we don't support generic associated types yet
555 }; 555 };
556 Some(rust_ir::InlineBound::AliasEqBound(alias_eq_bound)) 556 Some(rust_ir::InlineBound::AliasEqBound(alias_eq_bound))