diff options
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index f9877e760..c7055bee5 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -9,7 +9,7 @@ use base_db::CrateId; | |||
9 | use chalk_ir::Mutability; | 9 | use chalk_ir::Mutability; |
10 | use hir_def::{ | 10 | use hir_def::{ |
11 | lang_item::LangItemTarget, AssocContainerId, AssocItemId, FunctionId, GenericDefId, HasModule, | 11 | lang_item::LangItemTarget, AssocContainerId, AssocItemId, FunctionId, GenericDefId, HasModule, |
12 | ImplId, Lookup, ModuleId, TraitId, TypeAliasId, | 12 | ImplId, Lookup, ModuleId, TraitId, |
13 | }; | 13 | }; |
14 | use hir_expand::name::Name; | 14 | use hir_expand::name::Name; |
15 | use rustc_hash::{FxHashMap, FxHashSet}; | 15 | use rustc_hash::{FxHashMap, FxHashSet}; |
@@ -17,10 +17,11 @@ use rustc_hash::{FxHashMap, FxHashSet}; | |||
17 | use crate::{ | 17 | use crate::{ |
18 | autoderef, | 18 | autoderef, |
19 | db::HirDatabase, | 19 | db::HirDatabase, |
20 | from_foreign_def_id, | ||
20 | primitive::{self, FloatTy, IntTy, UintTy}, | 21 | primitive::{self, FloatTy, IntTy, UintTy}, |
21 | utils::all_super_traits, | 22 | utils::all_super_traits, |
22 | AdtId, Canonical, DebruijnIndex, FnPointer, FnSig, InEnvironment, Interner, Scalar, Substs, | 23 | AdtId, Canonical, DebruijnIndex, FnPointer, FnSig, ForeignDefId, InEnvironment, Interner, |
23 | TraitEnvironment, TraitRef, Ty, TyKind, TypeWalk, | 24 | Scalar, Substs, TraitEnvironment, TraitRef, Ty, TyKind, TypeWalk, |
24 | }; | 25 | }; |
25 | 26 | ||
26 | /// This is used as a key for indexing impls. | 27 | /// This is used as a key for indexing impls. |
@@ -35,7 +36,7 @@ pub enum TyFingerprint { | |||
35 | Adt(hir_def::AdtId), | 36 | Adt(hir_def::AdtId), |
36 | Dyn(TraitId), | 37 | Dyn(TraitId), |
37 | Tuple(usize), | 38 | Tuple(usize), |
38 | ForeignType(TypeAliasId), | 39 | ForeignType(ForeignDefId), |
39 | FnPtr(usize, FnSig), | 40 | FnPtr(usize, FnSig), |
40 | } | 41 | } |
41 | 42 | ||
@@ -236,8 +237,10 @@ impl Ty { | |||
236 | TyKind::Adt(AdtId(def_id), _) => { | 237 | TyKind::Adt(AdtId(def_id), _) => { |
237 | return mod_to_crate_ids(def_id.module(db.upcast())); | 238 | return mod_to_crate_ids(def_id.module(db.upcast())); |
238 | } | 239 | } |
239 | TyKind::ForeignType(type_alias_id) => { | 240 | TyKind::ForeignType(id) => { |
240 | return mod_to_crate_ids(type_alias_id.lookup(db.upcast()).module(db.upcast())); | 241 | return mod_to_crate_ids( |
242 | from_foreign_def_id(*id).lookup(db.upcast()).module(db.upcast()), | ||
243 | ); | ||
241 | } | 244 | } |
242 | TyKind::Scalar(Scalar::Bool) => lang_item_crate!("bool"), | 245 | TyKind::Scalar(Scalar::Bool) => lang_item_crate!("bool"), |
243 | TyKind::Scalar(Scalar::Char) => lang_item_crate!("char"), | 246 | TyKind::Scalar(Scalar::Char) => lang_item_crate!("char"), |