diff options
Diffstat (limited to 'crates/ra_hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/ra_hir_ty/src/method_resolution.rs | 71 |
1 files changed, 66 insertions, 5 deletions
diff --git a/crates/ra_hir_ty/src/method_resolution.rs b/crates/ra_hir_ty/src/method_resolution.rs index a45febbf7..fb4b30a13 100644 --- a/crates/ra_hir_ty/src/method_resolution.rs +++ b/crates/ra_hir_ty/src/method_resolution.rs | |||
@@ -6,8 +6,10 @@ use std::{iter, sync::Arc}; | |||
6 | 6 | ||
7 | use arrayvec::ArrayVec; | 7 | use arrayvec::ArrayVec; |
8 | use hir_def::{ | 8 | use hir_def::{ |
9 | lang_item::LangItemTarget, type_ref::Mutability, AssocContainerId, AssocItemId, FunctionId, | 9 | builtin_type::{IntBitness, Signedness}, |
10 | HasModule, ImplId, Lookup, TraitId, | 10 | lang_item::LangItemTarget, |
11 | type_ref::Mutability, | ||
12 | AssocContainerId, AssocItemId, FunctionId, HasModule, ImplId, Lookup, TraitId, | ||
11 | }; | 13 | }; |
12 | use hir_expand::name::Name; | 14 | use hir_expand::name::Name; |
13 | use ra_db::CrateId; | 15 | use ra_db::CrateId; |
@@ -16,9 +18,12 @@ use rustc_hash::{FxHashMap, FxHashSet}; | |||
16 | 18 | ||
17 | use super::Substs; | 19 | use super::Substs; |
18 | use crate::{ | 20 | use crate::{ |
19 | autoderef, db::HirDatabase, primitive::FloatBitness, utils::all_super_traits, ApplicationTy, | 21 | autoderef, |
20 | Canonical, DebruijnIndex, InEnvironment, TraitEnvironment, TraitRef, Ty, TyKind, TypeCtor, | 22 | db::HirDatabase, |
21 | TypeWalk, | 23 | primitive::{FloatBitness, FloatTy, IntTy}, |
24 | utils::all_super_traits, | ||
25 | ApplicationTy, Canonical, DebruijnIndex, InEnvironment, TraitEnvironment, TraitRef, Ty, TyKind, | ||
26 | TypeCtor, TypeWalk, | ||
22 | }; | 27 | }; |
23 | 28 | ||
24 | /// This is used as a key for indexing impls. | 29 | /// This is used as a key for indexing impls. |
@@ -39,6 +44,62 @@ impl TyFingerprint { | |||
39 | } | 44 | } |
40 | } | 45 | } |
41 | 46 | ||
47 | pub(crate) const ALL_INT_FPS: [TyFingerprint; 12] = [ | ||
48 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
49 | signedness: Signedness::Unsigned, | ||
50 | bitness: IntBitness::X8, | ||
51 | })), | ||
52 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
53 | signedness: Signedness::Unsigned, | ||
54 | bitness: IntBitness::X16, | ||
55 | })), | ||
56 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
57 | signedness: Signedness::Unsigned, | ||
58 | bitness: IntBitness::X32, | ||
59 | })), | ||
60 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
61 | signedness: Signedness::Unsigned, | ||
62 | bitness: IntBitness::X64, | ||
63 | })), | ||
64 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
65 | signedness: Signedness::Unsigned, | ||
66 | bitness: IntBitness::X128, | ||
67 | })), | ||
68 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
69 | signedness: Signedness::Unsigned, | ||
70 | bitness: IntBitness::Xsize, | ||
71 | })), | ||
72 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
73 | signedness: Signedness::Signed, | ||
74 | bitness: IntBitness::X8, | ||
75 | })), | ||
76 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
77 | signedness: Signedness::Signed, | ||
78 | bitness: IntBitness::X16, | ||
79 | })), | ||
80 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
81 | signedness: Signedness::Signed, | ||
82 | bitness: IntBitness::X32, | ||
83 | })), | ||
84 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
85 | signedness: Signedness::Signed, | ||
86 | bitness: IntBitness::X64, | ||
87 | })), | ||
88 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
89 | signedness: Signedness::Signed, | ||
90 | bitness: IntBitness::X128, | ||
91 | })), | ||
92 | TyFingerprint::Apply(TypeCtor::Int(IntTy { | ||
93 | signedness: Signedness::Signed, | ||
94 | bitness: IntBitness::Xsize, | ||
95 | })), | ||
96 | ]; | ||
97 | |||
98 | pub(crate) const ALL_FLOAT_FPS: [TyFingerprint; 2] = [ | ||
99 | TyFingerprint::Apply(TypeCtor::Float(FloatTy { bitness: FloatBitness::X32 })), | ||
100 | TyFingerprint::Apply(TypeCtor::Float(FloatTy { bitness: FloatBitness::X64 })), | ||
101 | ]; | ||
102 | |||
42 | /// Trait impls defined or available in some crate. | 103 | /// Trait impls defined or available in some crate. |
43 | #[derive(Debug, Eq, PartialEq)] | 104 | #[derive(Debug, Eq, PartialEq)] |
44 | pub struct TraitImpls { | 105 | pub struct TraitImpls { |