aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/lib.rs')
-rw-r--r--crates/ra_hir_ty/src/lib.rs14
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};
35use itertools::Itertools; 35use itertools::Itertools;
36use ra_db::{impl_intern_key, salsa, CrateId}; 36use ra_db::{salsa, CrateId};
37 37
38use crate::{ 38use crate::{
39 db::HirDatabase, 39 db::HirDatabase,
@@ -44,7 +44,7 @@ use crate::{
44 44
45pub use autoderef::autoderef; 45pub use autoderef::autoderef;
46pub use infer::{InferTy, InferenceResult}; 46pub use infer::{InferTy, InferenceResult};
47pub use lower::CallableDef; 47pub use lower::CallableDefId;
48pub use lower::{ 48pub 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)]
146pub struct CallableDefId(salsa::InternId);
147impl_intern_key!(CallableDefId);
148
149impl TypeCtor { 143impl 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))