diff options
author | Lukas Wirth <[email protected]> | 2021-02-28 21:12:07 +0000 |
---|---|---|
committer | Lukas Wirth <[email protected]> | 2021-02-28 22:53:21 +0000 |
commit | 407196b8c0f23e3ddc26e789b84542b1fd9b0eb8 (patch) | |
tree | 8f088d09b8a7a017335b90aefbc33211568eb4c3 /crates/hir_ty/src/method_resolution.rs | |
parent | 23d7dbfa5e7ba2cebf8c3f79b5d31285d79c1527 (diff) |
Lift FnPointer into a struct
Diffstat (limited to 'crates/hir_ty/src/method_resolution.rs')
-rw-r--r-- | crates/hir_ty/src/method_resolution.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/crates/hir_ty/src/method_resolution.rs b/crates/hir_ty/src/method_resolution.rs index ff8ce5599..c8a0ad5f1 100644 --- a/crates/hir_ty/src/method_resolution.rs +++ b/crates/hir_ty/src/method_resolution.rs | |||
@@ -18,8 +18,8 @@ use crate::{ | |||
18 | db::HirDatabase, | 18 | db::HirDatabase, |
19 | primitive::{self, FloatTy, IntTy, UintTy}, | 19 | primitive::{self, FloatTy, IntTy, UintTy}, |
20 | utils::all_super_traits, | 20 | utils::all_super_traits, |
21 | Canonical, DebruijnIndex, InEnvironment, Scalar, Substs, TraitEnvironment, TraitRef, Ty, | 21 | Canonical, DebruijnIndex, FnPointer, FnSig, InEnvironment, Scalar, Substs, TraitEnvironment, |
22 | TyKind, TypeWalk, | 22 | TraitRef, Ty, TyKind, TypeWalk, |
23 | }; | 23 | }; |
24 | 24 | ||
25 | /// This is used as a key for indexing impls. | 25 | /// This is used as a key for indexing impls. |
@@ -35,7 +35,7 @@ pub enum TyFingerprint { | |||
35 | Dyn(TraitId), | 35 | Dyn(TraitId), |
36 | Tuple(usize), | 36 | Tuple(usize), |
37 | ForeignType(TypeAliasId), | 37 | ForeignType(TypeAliasId), |
38 | FnPtr { num_args: u16, is_varargs: bool }, | 38 | FnPtr(usize, FnSig), |
39 | } | 39 | } |
40 | 40 | ||
41 | impl TyFingerprint { | 41 | impl TyFingerprint { |
@@ -53,9 +53,7 @@ impl TyFingerprint { | |||
53 | &Ty::Tuple(cardinality, _) => TyFingerprint::Tuple(cardinality), | 53 | &Ty::Tuple(cardinality, _) => TyFingerprint::Tuple(cardinality), |
54 | &Ty::RawPtr(mutability, ..) => TyFingerprint::RawPtr(mutability), | 54 | &Ty::RawPtr(mutability, ..) => TyFingerprint::RawPtr(mutability), |
55 | &Ty::ForeignType(alias_id, ..) => TyFingerprint::ForeignType(alias_id), | 55 | &Ty::ForeignType(alias_id, ..) => TyFingerprint::ForeignType(alias_id), |
56 | &Ty::FnPtr { num_args, is_varargs, .. } => { | 56 | &Ty::Function(FnPointer { num_args, sig, .. }) => TyFingerprint::FnPtr(num_args, sig), |
57 | TyFingerprint::FnPtr { num_args, is_varargs } | ||
58 | } | ||
59 | Ty::Dyn(_) => ty.dyn_trait().map(|trait_| TyFingerprint::Dyn(trait_))?, | 57 | Ty::Dyn(_) => ty.dyn_trait().map(|trait_| TyFingerprint::Dyn(trait_))?, |
60 | _ => return None, | 58 | _ => return None, |
61 | }; | 59 | }; |