diff options
Diffstat (limited to 'crates/ra_hir/src/ty/traits')
-rw-r--r-- | crates/ra_hir/src/ty/traits/chalk.rs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs index 9bf93981a..88785f305 100644 --- a/crates/ra_hir/src/ty/traits/chalk.rs +++ b/crates/ra_hir/src/ty/traits/chalk.rs | |||
@@ -16,10 +16,9 @@ use ra_db::salsa::{InternId, InternKey}; | |||
16 | use super::{AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; | 16 | use super::{AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; |
17 | use crate::{ | 17 | use crate::{ |
18 | db::HirDatabase, | 18 | db::HirDatabase, |
19 | generics::{GenericDef, HasGenericParams}, | ||
20 | ty::display::HirDisplay, | 19 | ty::display::HirDisplay, |
21 | ty::{ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk}, | 20 | ty::{ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk}, |
22 | Crate, HasBody, ImplBlock, Trait, TypeAlias, | 21 | Crate, GenericDef, HasBody, ImplBlock, Trait, TypeAlias, |
23 | }; | 22 | }; |
24 | 23 | ||
25 | /// This represents a trait whose name we could not resolve. | 24 | /// This represents a trait whose name we could not resolve. |
@@ -509,7 +508,7 @@ pub(crate) fn associated_ty_data_query( | |||
509 | Some(crate::Container::Trait(t)) => t, | 508 | Some(crate::Container::Trait(t)) => t, |
510 | _ => panic!("associated type not in trait"), | 509 | _ => panic!("associated type not in trait"), |
511 | }; | 510 | }; |
512 | let generic_params = type_alias.generic_params(db); | 511 | let generic_params = db.generic_params(type_alias.id.into()); |
513 | let bound_data = chalk_rust_ir::AssociatedTyDatumBound { | 512 | let bound_data = chalk_rust_ir::AssociatedTyDatumBound { |
514 | // FIXME add bounds and where clauses | 513 | // FIXME add bounds and where clauses |
515 | bounds: vec![], | 514 | bounds: vec![], |
@@ -550,7 +549,7 @@ pub(crate) fn trait_datum_query( | |||
550 | } | 549 | } |
551 | let trait_: Trait = from_chalk(db, trait_id); | 550 | let trait_: Trait = from_chalk(db, trait_id); |
552 | debug!("trait {:?} = {:?}", trait_id, trait_.name(db)); | 551 | debug!("trait {:?} = {:?}", trait_id, trait_.name(db)); |
553 | let generic_params = trait_.generic_params(db); | 552 | let generic_params = db.generic_params(trait_.id.into()); |
554 | let bound_vars = Substs::bound_vars(&generic_params); | 553 | let bound_vars = Substs::bound_vars(&generic_params); |
555 | let flags = chalk_rust_ir::TraitFlags { | 554 | let flags = chalk_rust_ir::TraitFlags { |
556 | auto: trait_.is_auto(db), | 555 | auto: trait_.is_auto(db), |
@@ -594,7 +593,7 @@ pub(crate) fn struct_datum_query( | |||
594 | let where_clauses = type_ctor | 593 | let where_clauses = type_ctor |
595 | .as_generic_def() | 594 | .as_generic_def() |
596 | .map(|generic_def| { | 595 | .map(|generic_def| { |
597 | let generic_params = generic_def.generic_params(db); | 596 | let generic_params = db.generic_params(generic_def.into()); |
598 | let bound_vars = Substs::bound_vars(&generic_params); | 597 | let bound_vars = Substs::bound_vars(&generic_params); |
599 | convert_where_clauses(db, generic_def, &bound_vars) | 598 | convert_where_clauses(db, generic_def, &bound_vars) |
600 | }) | 599 | }) |
@@ -634,7 +633,7 @@ fn impl_block_datum( | |||
634 | impl_id: ImplId, | 633 | impl_id: ImplId, |
635 | impl_block: ImplBlock, | 634 | impl_block: ImplBlock, |
636 | ) -> Option<Arc<ImplDatum<ChalkIr>>> { | 635 | ) -> Option<Arc<ImplDatum<ChalkIr>>> { |
637 | let generic_params = impl_block.generic_params(db); | 636 | let generic_params = db.generic_params(impl_block.id.into()); |
638 | let bound_vars = Substs::bound_vars(&generic_params); | 637 | let bound_vars = Substs::bound_vars(&generic_params); |
639 | let trait_ref = impl_block.target_trait_ref(db)?.subst(&bound_vars); | 638 | let trait_ref = impl_block.target_trait_ref(db)?.subst(&bound_vars); |
640 | let trait_ = trait_ref.trait_; | 639 | let trait_ = trait_ref.trait_; |
@@ -786,7 +785,7 @@ fn type_alias_associated_ty_value( | |||
786 | let assoc_ty = trait_ | 785 | let assoc_ty = trait_ |
787 | .associated_type_by_name(db, &type_alias.name(db)) | 786 | .associated_type_by_name(db, &type_alias.name(db)) |
788 | .expect("assoc ty value should not exist"); // validated when building the impl data as well | 787 | .expect("assoc ty value should not exist"); // validated when building the impl data as well |
789 | let generic_params = impl_block.generic_params(db); | 788 | let generic_params = db.generic_params(impl_block.id.into()); |
790 | let bound_vars = Substs::bound_vars(&generic_params); | 789 | let bound_vars = Substs::bound_vars(&generic_params); |
791 | let ty = db.type_for_def(type_alias.into(), crate::ty::Namespace::Types).subst(&bound_vars); | 790 | let ty = db.type_for_def(type_alias.into(), crate::ty::Namespace::Types).subst(&bound_vars); |
792 | let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.to_chalk(db) }; | 791 | let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.to_chalk(db) }; |