aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty/traits/chalk.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty/traits/chalk.rs')
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs32
1 files changed, 16 insertions, 16 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index 81a378bac..9bf93981a 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -418,20 +418,20 @@ fn convert_where_clauses(
418 result 418 result
419} 419}
420 420
421impl<'a, DB> chalk_solve::RustIrDatabase for ChalkContext<'a, DB> 421impl<'a, DB> chalk_solve::RustIrDatabase<ChalkIr> for ChalkContext<'a, DB>
422where 422where
423 DB: HirDatabase, 423 DB: HirDatabase,
424{ 424{
425 fn associated_ty_data(&self, id: TypeId) -> Arc<AssociatedTyDatum> { 425 fn associated_ty_data(&self, id: TypeId) -> Arc<AssociatedTyDatum<ChalkIr>> {
426 self.db.associated_ty_data(id) 426 self.db.associated_ty_data(id)
427 } 427 }
428 fn trait_datum(&self, trait_id: chalk_ir::TraitId) -> Arc<TraitDatum> { 428 fn trait_datum(&self, trait_id: chalk_ir::TraitId) -> Arc<TraitDatum<ChalkIr>> {
429 self.db.trait_datum(self.krate, trait_id) 429 self.db.trait_datum(self.krate, trait_id)
430 } 430 }
431 fn struct_datum(&self, struct_id: chalk_ir::StructId) -> Arc<StructDatum> { 431 fn struct_datum(&self, struct_id: chalk_ir::StructId) -> Arc<StructDatum<ChalkIr>> {
432 self.db.struct_datum(self.krate, struct_id) 432 self.db.struct_datum(self.krate, struct_id)
433 } 433 }
434 fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum> { 434 fn impl_datum(&self, impl_id: ImplId) -> Arc<ImplDatum<ChalkIr>> {
435 self.db.impl_datum(self.krate, impl_id) 435 self.db.impl_datum(self.krate, impl_id)
436 } 436 }
437 fn impls_for_trait( 437 fn impls_for_trait(
@@ -484,7 +484,7 @@ where
484 fn associated_ty_value( 484 fn associated_ty_value(
485 &self, 485 &self,
486 id: chalk_rust_ir::AssociatedTyValueId, 486 id: chalk_rust_ir::AssociatedTyValueId,
487 ) -> Arc<AssociatedTyValue> { 487 ) -> Arc<AssociatedTyValue<ChalkIr>> {
488 self.db.associated_ty_value(self.krate, id) 488 self.db.associated_ty_value(self.krate, id)
489 } 489 }
490 fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<ChalkIr>> { 490 fn custom_clauses(&self) -> Vec<chalk_ir::ProgramClause<ChalkIr>> {
@@ -502,7 +502,7 @@ where
502pub(crate) fn associated_ty_data_query( 502pub(crate) fn associated_ty_data_query(
503 db: &impl HirDatabase, 503 db: &impl HirDatabase,
504 id: TypeId, 504 id: TypeId,
505) -> Arc<AssociatedTyDatum> { 505) -> Arc<AssociatedTyDatum<ChalkIr>> {
506 debug!("associated_ty_data {:?}", id); 506 debug!("associated_ty_data {:?}", id);
507 let type_alias: TypeAlias = from_chalk(db, id); 507 let type_alias: TypeAlias = from_chalk(db, id);
508 let trait_ = match type_alias.container(db) { 508 let trait_ = match type_alias.container(db) {
@@ -528,7 +528,7 @@ pub(crate) fn trait_datum_query(
528 db: &impl HirDatabase, 528 db: &impl HirDatabase,
529 krate: Crate, 529 krate: Crate,
530 trait_id: chalk_ir::TraitId, 530 trait_id: chalk_ir::TraitId,
531) -> Arc<TraitDatum> { 531) -> Arc<TraitDatum<ChalkIr>> {
532 debug!("trait_datum {:?}", trait_id); 532 debug!("trait_datum {:?}", trait_id);
533 if trait_id == UNKNOWN_TRAIT { 533 if trait_id == UNKNOWN_TRAIT {
534 let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses: Vec::new() }; 534 let trait_datum_bound = chalk_rust_ir::TraitDatumBound { where_clauses: Vec::new() };
@@ -585,7 +585,7 @@ pub(crate) fn struct_datum_query(
585 db: &impl HirDatabase, 585 db: &impl HirDatabase,
586 krate: Crate, 586 krate: Crate,
587 struct_id: chalk_ir::StructId, 587 struct_id: chalk_ir::StructId,
588) -> Arc<StructDatum> { 588) -> Arc<StructDatum<ChalkIr>> {
589 debug!("struct_datum {:?}", struct_id); 589 debug!("struct_datum {:?}", struct_id);
590 let type_ctor: TypeCtor = from_chalk(db, struct_id); 590 let type_ctor: TypeCtor = from_chalk(db, struct_id);
591 debug!("struct {:?} = {:?}", struct_id, type_ctor); 591 debug!("struct {:?} = {:?}", struct_id, type_ctor);
@@ -617,7 +617,7 @@ pub(crate) fn impl_datum_query(
617 db: &impl HirDatabase, 617 db: &impl HirDatabase,
618 krate: Crate, 618 krate: Crate,
619 impl_id: ImplId, 619 impl_id: ImplId,
620) -> Arc<ImplDatum> { 620) -> Arc<ImplDatum<ChalkIr>> {
621 let _p = ra_prof::profile("impl_datum"); 621 let _p = ra_prof::profile("impl_datum");
622 debug!("impl_datum {:?}", impl_id); 622 debug!("impl_datum {:?}", impl_id);
623 let impl_: Impl = from_chalk(db, impl_id); 623 let impl_: Impl = from_chalk(db, impl_id);
@@ -633,7 +633,7 @@ fn impl_block_datum(
633 krate: Crate, 633 krate: Crate,
634 impl_id: ImplId, 634 impl_id: ImplId,
635 impl_block: ImplBlock, 635 impl_block: ImplBlock,
636) -> Option<Arc<ImplDatum>> { 636) -> Option<Arc<ImplDatum<ChalkIr>>> {
637 let generic_params = impl_block.generic_params(db); 637 let generic_params = impl_block.generic_params(db);
638 let bound_vars = Substs::bound_vars(&generic_params); 638 let bound_vars = Substs::bound_vars(&generic_params);
639 let trait_ref = impl_block.target_trait_ref(db)?.subst(&bound_vars); 639 let trait_ref = impl_block.target_trait_ref(db)?.subst(&bound_vars);
@@ -684,7 +684,7 @@ fn impl_block_datum(
684 Some(Arc::new(impl_datum)) 684 Some(Arc::new(impl_datum))
685} 685}
686 686
687fn invalid_impl_datum() -> Arc<ImplDatum> { 687fn invalid_impl_datum() -> Arc<ImplDatum<ChalkIr>> {
688 let trait_ref = chalk_ir::TraitRef { 688 let trait_ref = chalk_ir::TraitRef {
689 trait_id: UNKNOWN_TRAIT, 689 trait_id: UNKNOWN_TRAIT,
690 parameters: vec![chalk_ir::TyData::BoundVar(0).cast().intern().cast()], 690 parameters: vec![chalk_ir::TyData::BoundVar(0).cast().intern().cast()],
@@ -703,7 +703,7 @@ fn closure_fn_trait_impl_datum(
703 db: &impl HirDatabase, 703 db: &impl HirDatabase,
704 krate: Crate, 704 krate: Crate,
705 data: super::ClosureFnTraitImplData, 705 data: super::ClosureFnTraitImplData,
706) -> Option<Arc<ImplDatum>> { 706) -> Option<Arc<ImplDatum<ChalkIr>>> {
707 // for some closure |X, Y| -> Z: 707 // for some closure |X, Y| -> Z:
708 // impl<T, U, V> Fn<(T, U)> for closure<fn(T, U) -> V> { Output = V } 708 // impl<T, U, V> Fn<(T, U)> for closure<fn(T, U) -> V> { Output = V }
709 709
@@ -760,7 +760,7 @@ pub(crate) fn associated_ty_value_query(
760 db: &impl HirDatabase, 760 db: &impl HirDatabase,
761 krate: Crate, 761 krate: Crate,
762 id: chalk_rust_ir::AssociatedTyValueId, 762 id: chalk_rust_ir::AssociatedTyValueId,
763) -> Arc<chalk_rust_ir::AssociatedTyValue> { 763) -> Arc<chalk_rust_ir::AssociatedTyValue<ChalkIr>> {
764 let data: AssocTyValue = from_chalk(db, id); 764 let data: AssocTyValue = from_chalk(db, id);
765 match data { 765 match data {
766 AssocTyValue::TypeAlias(type_alias) => { 766 AssocTyValue::TypeAlias(type_alias) => {
@@ -776,7 +776,7 @@ fn type_alias_associated_ty_value(
776 db: &impl HirDatabase, 776 db: &impl HirDatabase,
777 _krate: Crate, 777 _krate: Crate,
778 type_alias: TypeAlias, 778 type_alias: TypeAlias,
779) -> Arc<AssociatedTyValue> { 779) -> Arc<AssociatedTyValue<ChalkIr>> {
780 let impl_block = type_alias.impl_block(db).expect("assoc ty value should be in impl"); 780 let impl_block = type_alias.impl_block(db).expect("assoc ty value should be in impl");
781 let impl_id = Impl::ImplBlock(impl_block).to_chalk(db); 781 let impl_id = Impl::ImplBlock(impl_block).to_chalk(db);
782 let trait_ = impl_block 782 let trait_ = impl_block
@@ -802,7 +802,7 @@ fn closure_fn_trait_output_assoc_ty_value(
802 db: &impl HirDatabase, 802 db: &impl HirDatabase,
803 krate: Crate, 803 krate: Crate,
804 data: super::ClosureFnTraitImplData, 804 data: super::ClosureFnTraitImplData,
805) -> Arc<AssociatedTyValue> { 805) -> Arc<AssociatedTyValue<ChalkIr>> {
806 let impl_id = Impl::ClosureFnTraitImpl(data.clone()).to_chalk(db); 806 let impl_id = Impl::ClosureFnTraitImpl(data.clone()).to_chalk(db);
807 807
808 let num_args: u16 = match &data.def.body(db)[data.expr] { 808 let num_args: u16 = match &data.def.body(db)[data.expr] {