@@ -6,8 +6,10 @@ use std::{iter, sync::Arc};
6
6
7
7
use arrayvec:: ArrayVec ;
8
8
use hir_def:: {
9
- lang_item:: LangItemTarget , type_ref:: Mutability , AssocContainerId , AssocItemId , FunctionId ,
10
- HasModule , ImplId , Lookup , TraitId ,
9
+ builtin_type:: { IntBitness , Signedness } ,
10
+ lang_item:: LangItemTarget ,
11
+ type_ref:: Mutability ,
12
+ AssocContainerId , AssocItemId , FunctionId , HasModule , ImplId , Lookup , TraitId ,
11
13
} ;
12
14
use hir_expand:: name:: Name ;
13
15
use ra_db:: CrateId ;
@@ -16,9 +18,12 @@ use rustc_hash::{FxHashMap, FxHashSet};
16
18
17
19
use super :: Substs ;
18
20
use crate :: {
19
- autoderef, db:: HirDatabase , primitive:: FloatBitness , utils:: all_super_traits, ApplicationTy ,
20
- Canonical , DebruijnIndex , InEnvironment , TraitEnvironment , TraitRef , Ty , TyKind , TypeCtor ,
21
- TypeWalk ,
21
+ autoderef,
22
+ db:: HirDatabase ,
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
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
103
/// Trait impls defined or available in some crate.
43
104
#[ derive( Debug , Eq , PartialEq ) ]
44
105
pub struct TraitImpls {
0 commit comments