diff options
Diffstat (limited to 'crates/ra_hir_ty/src/traits/chalk.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index e3f02fa15..1e7ff93d5 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -19,8 +19,8 @@ use ra_db::{ | |||
19 | 19 | ||
20 | use super::{builtin, AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; | 20 | use super::{builtin, AssocTyValue, Canonical, ChalkContext, Impl, Obligation}; |
21 | use crate::{ | 21 | use crate::{ |
22 | db::HirDatabase, display::HirDisplay, ApplicationTy, GenericPredicate, ProjectionTy, Substs, | 22 | db::HirDatabase, display::HirDisplay, utils::generics, ApplicationTy, GenericPredicate, |
23 | TraitRef, Ty, TypeCtor, TypeWalk, | 23 | ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk, |
24 | }; | 24 | }; |
25 | 25 | ||
26 | /// This represents a trait whose name we could not resolve. | 26 | /// This represents a trait whose name we could not resolve. |
@@ -547,7 +547,7 @@ pub(crate) fn associated_ty_data_query( | |||
547 | ContainerId::TraitId(t) => t, | 547 | ContainerId::TraitId(t) => t, |
548 | _ => panic!("associated type not in trait"), | 548 | _ => panic!("associated type not in trait"), |
549 | }; | 549 | }; |
550 | let generic_params = db.generic_params(type_alias.into()); | 550 | let generic_params = generics(db, type_alias.into()); |
551 | let bound_data = chalk_rust_ir::AssociatedTyDatumBound { | 551 | let bound_data = chalk_rust_ir::AssociatedTyDatumBound { |
552 | // FIXME add bounds and where clauses | 552 | // FIXME add bounds and where clauses |
553 | bounds: vec![], | 553 | bounds: vec![], |
@@ -557,7 +557,7 @@ pub(crate) fn associated_ty_data_query( | |||
557 | trait_id: trait_.to_chalk(db), | 557 | trait_id: trait_.to_chalk(db), |
558 | id, | 558 | id, |
559 | name: lalrpop_intern::intern(&db.type_alias_data(type_alias).name.to_string()), | 559 | name: lalrpop_intern::intern(&db.type_alias_data(type_alias).name.to_string()), |
560 | binders: make_binders(bound_data, generic_params.count_params_including_parent()), | 560 | binders: make_binders(bound_data, generic_params.len()), |
561 | }; | 561 | }; |
562 | Arc::new(datum) | 562 | Arc::new(datum) |
563 | } | 563 | } |
@@ -589,7 +589,7 @@ pub(crate) fn trait_datum_query( | |||
589 | let trait_: TraitId = from_chalk(db, trait_id); | 589 | let trait_: TraitId = from_chalk(db, trait_id); |
590 | let trait_data = db.trait_data(trait_); | 590 | let trait_data = db.trait_data(trait_); |
591 | debug!("trait {:?} = {:?}", trait_id, trait_data.name); | 591 | debug!("trait {:?} = {:?}", trait_id, trait_data.name); |
592 | let generic_params = db.generic_params(trait_.into()); | 592 | let generic_params = generics(db, trait_.into()); |
593 | let bound_vars = Substs::bound_vars(&generic_params); | 593 | let bound_vars = Substs::bound_vars(&generic_params); |
594 | let flags = chalk_rust_ir::TraitFlags { | 594 | let flags = chalk_rust_ir::TraitFlags { |
595 | auto: trait_data.auto, | 595 | auto: trait_data.auto, |
@@ -626,7 +626,7 @@ pub(crate) fn struct_datum_query( | |||
626 | let where_clauses = type_ctor | 626 | let where_clauses = type_ctor |
627 | .as_generic_def() | 627 | .as_generic_def() |
628 | .map(|generic_def| { | 628 | .map(|generic_def| { |
629 | let generic_params = db.generic_params(generic_def.into()); | 629 | let generic_params = generics(db, generic_def.into()); |
630 | let bound_vars = Substs::bound_vars(&generic_params); | 630 | let bound_vars = Substs::bound_vars(&generic_params); |
631 | convert_where_clauses(db, generic_def, &bound_vars) | 631 | convert_where_clauses(db, generic_def, &bound_vars) |
632 | }) | 632 | }) |
@@ -669,7 +669,7 @@ fn impl_block_datum( | |||
669 | let trait_ref = db.impl_trait(impl_id)?; | 669 | let trait_ref = db.impl_trait(impl_id)?; |
670 | let impl_data = db.impl_data(impl_id); | 670 | let impl_data = db.impl_data(impl_id); |
671 | 671 | ||
672 | let generic_params = db.generic_params(impl_id.into()); | 672 | let generic_params = generics(db, impl_id.into()); |
673 | let bound_vars = Substs::bound_vars(&generic_params); | 673 | let bound_vars = Substs::bound_vars(&generic_params); |
674 | let trait_ref = trait_ref.subst(&bound_vars); | 674 | let trait_ref = trait_ref.subst(&bound_vars); |
675 | let trait_ = trait_ref.trait_; | 675 | let trait_ = trait_ref.trait_; |
@@ -767,7 +767,7 @@ fn type_alias_associated_ty_value( | |||
767 | .trait_data(trait_ref.trait_) | 767 | .trait_data(trait_ref.trait_) |
768 | .associated_type_by_name(&type_alias_data.name) | 768 | .associated_type_by_name(&type_alias_data.name) |
769 | .expect("assoc ty value should not exist"); // validated when building the impl data as well | 769 | .expect("assoc ty value should not exist"); // validated when building the impl data as well |
770 | let generic_params = db.generic_params(impl_id.into()); | 770 | let generic_params = generics(db, impl_id.into()); |
771 | let bound_vars = Substs::bound_vars(&generic_params); | 771 | let bound_vars = Substs::bound_vars(&generic_params); |
772 | let ty = db.ty(type_alias.into()).subst(&bound_vars); | 772 | let ty = db.ty(type_alias.into()).subst(&bound_vars); |
773 | let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.to_chalk(db) }; | 773 | let value_bound = chalk_rust_ir::AssociatedTyValueBound { ty: ty.to_chalk(db) }; |