diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-07-16 12:17:53 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-16 12:17:53 +0100 |
commit | 468982e45a035c271c40bea9b17c2c202a7efc75 (patch) | |
tree | 96f00583eaa8659a21960fa5fc4717d4d9bf0962 /crates/ra_hir_ty/src/lib.rs | |
parent | 8a880230a522b34a0ba7f434f4ad3acdfd3448b1 (diff) | |
parent | b5ce84b17023d27f4e96ec7911aca712db0e000b (diff) |
Merge #5405
5405: Align CallableDefId naming with other ids r=matklad a=matklad
bors r+
🤖
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir_ty/src/lib.rs')
-rw-r--r-- | crates/ra_hir_ty/src/lib.rs | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/crates/ra_hir_ty/src/lib.rs b/crates/ra_hir_ty/src/lib.rs index 9f034eca5..0ef5ca78f 100644 --- a/crates/ra_hir_ty/src/lib.rs +++ b/crates/ra_hir_ty/src/lib.rs | |||
@@ -33,7 +33,7 @@ use hir_def::{ | |||
33 | TypeParamId, | 33 | TypeParamId, |
34 | }; | 34 | }; |
35 | use itertools::Itertools; | 35 | use itertools::Itertools; |
36 | use ra_db::{impl_intern_key, salsa, CrateId}; | 36 | use ra_db::{salsa, CrateId}; |
37 | 37 | ||
38 | use crate::{ | 38 | use crate::{ |
39 | db::HirDatabase, | 39 | db::HirDatabase, |
@@ -44,7 +44,7 @@ use crate::{ | |||
44 | 44 | ||
45 | pub use autoderef::autoderef; | 45 | pub use autoderef::autoderef; |
46 | pub use infer::{InferTy, InferenceResult}; | 46 | pub use infer::{InferTy, InferenceResult}; |
47 | pub use lower::CallableDef; | 47 | pub use lower::CallableDefId; |
48 | pub use lower::{ | 48 | pub use lower::{ |
49 | associated_type_shorthand_candidates, callable_item_sig, ImplTraitLoweringMode, TyDefId, | 49 | associated_type_shorthand_candidates, callable_item_sig, ImplTraitLoweringMode, TyDefId, |
50 | TyLoweringContext, ValueTyDefId, | 50 | TyLoweringContext, ValueTyDefId, |
@@ -102,7 +102,7 @@ pub enum TypeCtor { | |||
102 | /// fn foo() -> i32 { 1 } | 102 | /// fn foo() -> i32 { 1 } |
103 | /// let bar = foo; // bar: fn() -> i32 {foo} | 103 | /// let bar = foo; // bar: fn() -> i32 {foo} |
104 | /// ``` | 104 | /// ``` |
105 | FnDef(CallableDef), | 105 | FnDef(CallableDefId), |
106 | 106 | ||
107 | /// A pointer to a function. Written as `fn() -> i32`. | 107 | /// A pointer to a function. Written as `fn() -> i32`. |
108 | /// | 108 | /// |
@@ -140,12 +140,6 @@ pub enum TypeCtor { | |||
140 | Closure { def: DefWithBodyId, expr: ExprId }, | 140 | Closure { def: DefWithBodyId, expr: ExprId }, |
141 | } | 141 | } |
142 | 142 | ||
143 | /// This exists just for Chalk, because Chalk just has a single `FnDefId` where | ||
144 | /// we have different IDs for struct and enum variant constructors. | ||
145 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd)] | ||
146 | pub struct CallableDefId(salsa::InternId); | ||
147 | impl_intern_key!(CallableDefId); | ||
148 | |||
149 | impl TypeCtor { | 143 | impl TypeCtor { |
150 | pub fn num_ty_params(self, db: &dyn HirDatabase) -> usize { | 144 | pub fn num_ty_params(self, db: &dyn HirDatabase) -> usize { |
151 | match self { | 145 | match self { |
@@ -773,7 +767,7 @@ impl Ty { | |||
773 | } | 767 | } |
774 | } | 768 | } |
775 | 769 | ||
776 | pub fn as_callable(&self) -> Option<(CallableDef, &Substs)> { | 770 | pub fn as_callable(&self) -> Option<(CallableDefId, &Substs)> { |
777 | match self { | 771 | match self { |
778 | Ty::Apply(ApplicationTy { ctor: TypeCtor::FnDef(callable_def), parameters }) => { | 772 | Ty::Apply(ApplicationTy { ctor: TypeCtor::FnDef(callable_def), parameters }) => { |
779 | Some((*callable_def, parameters)) | 773 | Some((*callable_def, parameters)) |