aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-11-25 12:39:12 +0000
committerAleksey Kladov <[email protected]>2019-11-25 12:39:12 +0000
commitc2a16632d0773dec707acb215297ef55b5c880fe (patch)
tree5cb05c66e7d6bfc51f206f27f561f3b54971c7b4 /crates/ra_hir/src/ty
parent9f7fcc6ecd5334c5e3caa365c4a6d7bf3f37b649 (diff)
Use GenericDefId more
Diffstat (limited to 'crates/ra_hir/src/ty')
-rw-r--r--crates/ra_hir/src/ty/lower.rs16
-rw-r--r--crates/ra_hir/src/ty/traits/chalk.rs10
2 files changed, 13 insertions, 13 deletions
diff --git a/crates/ra_hir/src/ty/lower.rs b/crates/ra_hir/src/ty/lower.rs
index b76929501..da3c8e94a 100644
--- a/crates/ra_hir/src/ty/lower.rs
+++ b/crates/ra_hir/src/ty/lower.rs
@@ -14,7 +14,7 @@ use hir_def::{
14 path::{GenericArg, PathSegment}, 14 path::{GenericArg, PathSegment},
15 resolver::{HasResolver, Resolver, TypeNs}, 15 resolver::{HasResolver, Resolver, TypeNs},
16 type_ref::{TypeBound, TypeRef}, 16 type_ref::{TypeBound, TypeRef},
17 AdtId, GenericDefId, LocalStructFieldId, VariantId, 17 AdtId, EnumVariantId, GenericDefId, LocalStructFieldId, VariantId,
18}; 18};
19use ra_arena::map::ArenaMap; 19use ra_arena::map::ArenaMap;
20 20
@@ -605,9 +605,9 @@ impl TraitEnvironment {
605/// Resolve the where clause(s) of an item with generics. 605/// Resolve the where clause(s) of an item with generics.
606pub(crate) fn generic_predicates_query( 606pub(crate) fn generic_predicates_query(
607 db: &impl HirDatabase, 607 db: &impl HirDatabase,
608 def: GenericDef, 608 def: GenericDefId,
609) -> Arc<[GenericPredicate]> { 609) -> Arc<[GenericPredicate]> {
610 let resolver = GenericDefId::from(def).resolver(db); 610 let resolver = def.resolver(db);
611 resolver 611 resolver
612 .where_predicates_in_scope() 612 .where_predicates_in_scope()
613 .flat_map(|pred| GenericPredicate::from_where_predicate(db, &resolver, pred)) 613 .flat_map(|pred| GenericPredicate::from_where_predicate(db, &resolver, pred))
@@ -819,12 +819,12 @@ impl CallableDef {
819 } 819 }
820} 820}
821 821
822impl From<CallableDef> for GenericDef { 822impl From<CallableDef> for GenericDefId {
823 fn from(def: CallableDef) -> GenericDef { 823 fn from(def: CallableDef) -> GenericDefId {
824 match def { 824 match def {
825 CallableDef::Function(f) => f.into(), 825 CallableDef::Function(f) => f.id.into(),
826 CallableDef::Struct(s) => s.into(), 826 CallableDef::Struct(s) => s.id.into(),
827 CallableDef::EnumVariant(e) => e.into(), 827 CallableDef::EnumVariant(e) => EnumVariantId::from(e).into(),
828 } 828 }
829 } 829 }
830} 830}
diff --git a/crates/ra_hir/src/ty/traits/chalk.rs b/crates/ra_hir/src/ty/traits/chalk.rs
index 1a93e5e50..a0dbf6305 100644
--- a/crates/ra_hir/src/ty/traits/chalk.rs
+++ b/crates/ra_hir/src/ty/traits/chalk.rs
@@ -9,7 +9,7 @@ use chalk_ir::{
9}; 9};
10use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum}; 10use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum};
11 11
12use hir_def::lang_item::LangItemTarget; 12use hir_def::{lang_item::LangItemTarget, GenericDefId};
13use hir_expand::name; 13use hir_expand::name;
14 14
15use ra_db::salsa::{InternId, InternKey}; 15use ra_db::salsa::{InternId, InternKey};
@@ -19,7 +19,7 @@ use crate::{
19 db::HirDatabase, 19 db::HirDatabase,
20 ty::display::HirDisplay, 20 ty::display::HirDisplay,
21 ty::{ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk}, 21 ty::{ApplicationTy, GenericPredicate, ProjectionTy, Substs, TraitRef, Ty, TypeCtor, TypeWalk},
22 Crate, GenericDef, ImplBlock, Trait, TypeAlias, 22 Crate, ImplBlock, Trait, TypeAlias,
23}; 23};
24 24
25/// This represents a trait whose name we could not resolve. 25/// This represents a trait whose name we could not resolve.
@@ -402,7 +402,7 @@ fn make_binders<T>(value: T, num_vars: usize) -> chalk_ir::Binders<T> {
402 402
403fn convert_where_clauses( 403fn convert_where_clauses(
404 db: &impl HirDatabase, 404 db: &impl HirDatabase,
405 def: GenericDef, 405 def: GenericDefId,
406 substs: &Substs, 406 substs: &Substs,
407) -> Vec<chalk_ir::QuantifiedWhereClause<ChalkIr>> { 407) -> Vec<chalk_ir::QuantifiedWhereClause<ChalkIr>> {
408 let generic_predicates = db.generic_predicates(def); 408 let generic_predicates = db.generic_predicates(def);
@@ -561,7 +561,7 @@ pub(crate) fn trait_datum_query(
561 marker: false, 561 marker: false,
562 fundamental: false, 562 fundamental: false,
563 }; 563 };
564 let where_clauses = convert_where_clauses(db, trait_.into(), &bound_vars); 564 let where_clauses = convert_where_clauses(db, trait_.id.into(), &bound_vars);
565 let associated_ty_ids = trait_ 565 let associated_ty_ids = trait_
566 .items(db) 566 .items(db)
567 .into_iter() 567 .into_iter()
@@ -643,7 +643,7 @@ fn impl_block_datum(
643 } else { 643 } else {
644 chalk_rust_ir::ImplType::External 644 chalk_rust_ir::ImplType::External
645 }; 645 };
646 let where_clauses = convert_where_clauses(db, impl_block.into(), &bound_vars); 646 let where_clauses = convert_where_clauses(db, impl_block.id.into(), &bound_vars);
647 let negative = impl_block.is_negative(db); 647 let negative = impl_block.is_negative(db);
648 debug!( 648 debug!(
649 "impl {:?}: {}{} where {:?}", 649 "impl {:?}: {}{} where {:?}",