diff options
Diffstat (limited to 'crates/ra_hir_ty')
-rw-r--r-- | crates/ra_hir_ty/src/lower.rs | 9 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/method_resolution.rs | 6 | ||||
-rw-r--r-- | crates/ra_hir_ty/src/traits/chalk.rs | 8 |
3 files changed, 11 insertions, 12 deletions
diff --git a/crates/ra_hir_ty/src/lower.rs b/crates/ra_hir_ty/src/lower.rs index eab91229e..5f795bc02 100644 --- a/crates/ra_hir_ty/src/lower.rs +++ b/crates/ra_hir_ty/src/lower.rs | |||
@@ -14,7 +14,7 @@ use hir_def::{ | |||
14 | path::{GenericArg, Path, PathKind, PathSegment}, | 14 | path::{GenericArg, Path, PathKind, PathSegment}, |
15 | resolver::{HasResolver, Resolver, TypeNs}, | 15 | resolver::{HasResolver, Resolver, TypeNs}, |
16 | type_ref::{TypeBound, TypeRef}, | 16 | type_ref::{TypeBound, TypeRef}, |
17 | AdtId, AstItemDef, ConstId, EnumId, EnumVariantId, FunctionId, GenericDefId, HasModule, ImplId, | 17 | AdtId, ConstId, EnumId, EnumVariantId, FunctionId, GenericDefId, HasModule, ImplId, |
18 | LocalStructFieldId, Lookup, StaticId, StructId, TraitId, TypeAliasId, UnionId, VariantId, | 18 | LocalStructFieldId, Lookup, StaticId, StructId, TraitId, TypeAliasId, UnionId, VariantId, |
19 | }; | 19 | }; |
20 | use ra_arena::map::ArenaMap; | 20 | use ra_arena::map::ArenaMap; |
@@ -698,10 +698,11 @@ impl_froms!(CallableDef: FunctionId, StructId, EnumVariantId); | |||
698 | impl CallableDef { | 698 | impl CallableDef { |
699 | pub fn krate(self, db: &impl HirDatabase) -> CrateId { | 699 | pub fn krate(self, db: &impl HirDatabase) -> CrateId { |
700 | match self { | 700 | match self { |
701 | CallableDef::FunctionId(f) => f.lookup(db).module(db).krate, | 701 | CallableDef::FunctionId(f) => f.lookup(db).module(db), |
702 | CallableDef::StructId(s) => s.module(db).krate, | 702 | CallableDef::StructId(s) => s.lookup(db).container, |
703 | CallableDef::EnumVariantId(e) => e.parent.module(db).krate, | 703 | CallableDef::EnumVariantId(e) => e.parent.lookup(db).container, |
704 | } | 704 | } |
705 | .krate | ||
705 | } | 706 | } |
706 | } | 707 | } |
707 | 708 | ||
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs index 7220d6e0a..848e306e9 100644 --- a/crates/ra_hir_ty/src/method_resolution.rs +++ b/crates/ra_hir_ty/src/method_resolution.rs | |||
@@ -6,8 +6,8 @@ use std::sync::Arc; | |||
6 | 6 | ||
7 | use arrayvec::ArrayVec; | 7 | use arrayvec::ArrayVec; |
8 | use hir_def::{ | 8 | use hir_def::{ |
9 | lang_item::LangItemTarget, resolver::Resolver, type_ref::Mutability, AssocItemId, AstItemDef, | 9 | lang_item::LangItemTarget, resolver::Resolver, type_ref::Mutability, AssocItemId, FunctionId, |
10 | FunctionId, HasModule, ImplId, Lookup, TraitId, | 10 | HasModule, ImplId, Lookup, TraitId, |
11 | }; | 11 | }; |
12 | use hir_expand::name::Name; | 12 | use hir_expand::name::Name; |
13 | use ra_db::CrateId; | 13 | use ra_db::CrateId; |
@@ -134,7 +134,7 @@ impl Ty { | |||
134 | LangItemTarget::ImplBlockId(it) => Some(it), | 134 | LangItemTarget::ImplBlockId(it) => Some(it), |
135 | _ => None, | 135 | _ => None, |
136 | }) | 136 | }) |
137 | .map(|it| it.module(db).krate) | 137 | .map(|it| it.lookup(db).container.krate) |
138 | .collect(); | 138 | .collect(); |
139 | Some(res) | 139 | Some(res) |
140 | } | 140 | } |
diff --git a/crates/ra_hir_ty/src/traits/chalk.rs b/crates/ra_hir_ty/src/traits/chalk.rs index 1e7ff93d5..fc21872b2 100644 --- a/crates/ra_hir_ty/src/traits/chalk.rs +++ b/crates/ra_hir_ty/src/traits/chalk.rs | |||
@@ -9,9 +9,7 @@ use chalk_ir::{ | |||
9 | }; | 9 | }; |
10 | use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum}; | 10 | use chalk_rust_ir::{AssociatedTyDatum, AssociatedTyValue, ImplDatum, StructDatum, TraitDatum}; |
11 | 11 | ||
12 | use hir_def::{ | 12 | use hir_def::{AssocItemId, ContainerId, GenericDefId, ImplId, Lookup, TraitId, TypeAliasId}; |
13 | AssocItemId, AstItemDef, ContainerId, GenericDefId, ImplId, Lookup, TraitId, TypeAliasId, | ||
14 | }; | ||
15 | use ra_db::{ | 13 | use ra_db::{ |
16 | salsa::{InternId, InternKey}, | 14 | salsa::{InternId, InternKey}, |
17 | CrateId, | 15 | CrateId, |
@@ -593,7 +591,7 @@ pub(crate) fn trait_datum_query( | |||
593 | let bound_vars = Substs::bound_vars(&generic_params); | 591 | let bound_vars = Substs::bound_vars(&generic_params); |
594 | let flags = chalk_rust_ir::TraitFlags { | 592 | let flags = chalk_rust_ir::TraitFlags { |
595 | auto: trait_data.auto, | 593 | auto: trait_data.auto, |
596 | upstream: trait_.module(db).krate != krate, | 594 | upstream: trait_.lookup(db).container.krate != krate, |
597 | non_enumerable: true, | 595 | non_enumerable: true, |
598 | coinductive: false, // only relevant for Chalk testing | 596 | coinductive: false, // only relevant for Chalk testing |
599 | // FIXME set these flags correctly | 597 | // FIXME set these flags correctly |
@@ -673,7 +671,7 @@ fn impl_block_datum( | |||
673 | let bound_vars = Substs::bound_vars(&generic_params); | 671 | let bound_vars = Substs::bound_vars(&generic_params); |
674 | let trait_ref = trait_ref.subst(&bound_vars); | 672 | let trait_ref = trait_ref.subst(&bound_vars); |
675 | let trait_ = trait_ref.trait_; | 673 | let trait_ = trait_ref.trait_; |
676 | let impl_type = if impl_id.module(db).krate == krate { | 674 | let impl_type = if impl_id.lookup(db).container.krate == krate { |
677 | chalk_rust_ir::ImplType::Local | 675 | chalk_rust_ir::ImplType::Local |
678 | } else { | 676 | } else { |
679 | chalk_rust_ir::ImplType::External | 677 | chalk_rust_ir::ImplType::External |