aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/ty.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/ty.rs')
-rw-r--r--crates/ra_hir/src/ty.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/ra_hir/src/ty.rs b/crates/ra_hir/src/ty.rs
index 95b8df181..f62316c1f 100644
--- a/crates/ra_hir/src/ty.rs
+++ b/crates/ra_hir/src/ty.rs
@@ -18,6 +18,7 @@ use std::sync::Arc;
18use std::{fmt, iter, mem}; 18use std::{fmt, iter, mem};
19 19
20use hir_def::{generics::GenericParams, AdtId}; 20use hir_def::{generics::GenericParams, AdtId};
21use ra_db::{impl_intern_key, salsa};
21 22
22use crate::{ 23use crate::{
23 db::HirDatabase, expr::ExprId, util::make_mut_slice, Adt, Crate, DefWithBody, FloatTy, 24 db::HirDatabase, expr::ExprId, util::make_mut_slice, Adt, Crate, DefWithBody, FloatTy,
@@ -29,8 +30,9 @@ pub(crate) use autoderef::autoderef;
29pub(crate) use infer::{infer_query, InferTy, InferenceResult}; 30pub(crate) use infer::{infer_query, InferTy, InferenceResult};
30pub use lower::CallableDef; 31pub use lower::CallableDef;
31pub(crate) use lower::{ 32pub(crate) use lower::{
32 callable_item_sig, generic_defaults_query, generic_predicates_for_param_query, 33 callable_item_sig, field_types_query, generic_defaults_query,
33 generic_predicates_query, type_for_def, type_for_field, Namespace, TypableDef, 34 generic_predicates_for_param_query, generic_predicates_query, type_for_def, Namespace,
35 TypableDef,
34}; 36};
35pub(crate) use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment}; 37pub(crate) use traits::{InEnvironment, Obligation, ProjectionPredicate, TraitEnvironment};
36 38
@@ -114,6 +116,13 @@ pub enum TypeCtor {
114 Closure { def: DefWithBody, expr: ExprId }, 116 Closure { def: DefWithBody, expr: ExprId },
115} 117}
116 118
119/// This exists just for Chalk, because Chalk just has a single `StructId` where
120/// we have different kinds of ADTs, primitive types and special type
121/// constructors like tuples and function pointers.
122#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
123pub struct TypeCtorId(salsa::InternId);
124impl_intern_key!(TypeCtorId);
125
117impl TypeCtor { 126impl TypeCtor {
118 pub fn num_ty_params(self, db: &impl HirDatabase) -> usize { 127 pub fn num_ty_params(self, db: &impl HirDatabase) -> usize {
119 match self { 128 match self {