aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/hir_ty/src/chalk_cast.rs16
-rw-r--r--crates/hir_ty/src/interner.rs9
-rw-r--r--crates/hir_ty/src/lib.rs42
3 files changed, 29 insertions, 38 deletions
diff --git a/crates/hir_ty/src/chalk_cast.rs b/crates/hir_ty/src/chalk_cast.rs
deleted file mode 100644
index f27dee3fd..000000000
--- a/crates/hir_ty/src/chalk_cast.rs
+++ /dev/null
@@ -1,16 +0,0 @@
1//! Implementations of the Chalk `Cast` trait for our types.
2
3use chalk_ir::interner::HasInterner;
4
5use crate::{CallableSig, ReturnTypeImplTraits};
6
7macro_rules! has_interner {
8 ($t:ty) => {
9 impl HasInterner for $t {
10 type Interner = crate::Interner;
11 }
12 };
13}
14
15has_interner!(CallableSig);
16has_interner!(ReturnTypeImplTraits);
diff --git a/crates/hir_ty/src/interner.rs b/crates/hir_ty/src/interner.rs
index 02e26c04e..a1656115d 100644
--- a/crates/hir_ty/src/interner.rs
+++ b/crates/hir_ty/src/interner.rs
@@ -412,3 +412,12 @@ impl chalk_ir::interner::Interner for Interner {
412impl chalk_ir::interner::HasInterner for Interner { 412impl chalk_ir::interner::HasInterner for Interner {
413 type Interner = Self; 413 type Interner = Self;
414} 414}
415
416#[macro_export]
417macro_rules! has_interner {
418 ($t:ty) => {
419 impl HasInterner for $t {
420 type Interner = crate::Interner;
421 }
422 };
423}
diff --git a/crates/hir_ty/src/lib.rs b/crates/hir_ty/src/lib.rs
index 6b5006f5d..ef1bdefac 100644
--- a/crates/hir_ty/src/lib.rs
+++ b/crates/hir_ty/src/lib.rs
@@ -7,25 +7,23 @@ macro_rules! eprintln {
7} 7}
8 8
9mod autoderef; 9mod autoderef;
10pub mod primitive;
11pub mod traits;
12pub mod method_resolution;
13mod op;
14mod lower;
15pub(crate) mod infer;
16pub(crate) mod utils;
17mod chalk_cast;
18mod chalk_ext;
19mod builder; 10mod builder;
20mod walk; 11mod chalk_db;
21mod tls; 12mod chalk_ext;
13mod infer;
22mod interner; 14mod interner;
15mod lower;
23mod mapping; 16mod mapping;
24mod chalk_db; 17mod op;
25 18mod tls;
26pub mod display; 19mod utils;
20mod walk;
27pub mod db; 21pub mod db;
28pub mod diagnostics; 22pub mod diagnostics;
23pub mod display;
24pub mod method_resolution;
25pub mod primitive;
26pub mod traits;
29 27
30#[cfg(test)] 28#[cfg(test)]
31mod tests; 29mod tests;
@@ -100,6 +98,10 @@ pub type ConstValue = chalk_ir::ConstValue<Interner>;
100pub type ConcreteConst = chalk_ir::ConcreteConst<Interner>; 98pub type ConcreteConst = chalk_ir::ConcreteConst<Interner>;
101 99
102pub type ChalkTraitId = chalk_ir::TraitId<Interner>; 100pub type ChalkTraitId = chalk_ir::TraitId<Interner>;
101pub type TraitRef = chalk_ir::TraitRef<Interner>;
102pub type QuantifiedWhereClause = Binders<WhereClause>;
103pub type QuantifiedWhereClauses = chalk_ir::QuantifiedWhereClauses<Interner>;
104pub type Canonical<T> = chalk_ir::Canonical<T>;
103 105
104pub type FnSig = chalk_ir::FnSig<Interner>; 106pub type FnSig = chalk_ir::FnSig<Interner>;
105 107
@@ -159,14 +161,6 @@ pub fn make_canonical<T: HasInterner<Interner = Interner>>(
159 Canonical { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) } 161 Canonical { value, binders: chalk_ir::CanonicalVarKinds::from_iter(&Interner, kinds) }
160} 162}
161 163
162pub type TraitRef = chalk_ir::TraitRef<Interner>;
163
164pub type QuantifiedWhereClause = Binders<WhereClause>;
165
166pub type QuantifiedWhereClauses = chalk_ir::QuantifiedWhereClauses<Interner>;
167
168pub type Canonical<T> = chalk_ir::Canonical<T>;
169
170/// A function signature as seen by type inference: Several parameter types and 164/// A function signature as seen by type inference: Several parameter types and
171/// one return type. 165/// one return type.
172#[derive(Clone, PartialEq, Eq, Debug)] 166#[derive(Clone, PartialEq, Eq, Debug)]
@@ -175,6 +169,8 @@ pub struct CallableSig {
175 is_varargs: bool, 169 is_varargs: bool,
176} 170}
177 171
172has_interner!(CallableSig);
173
178/// A polymorphic function signature. 174/// A polymorphic function signature.
179pub type PolyFnSig = Binders<CallableSig>; 175pub type PolyFnSig = Binders<CallableSig>;
180 176
@@ -238,6 +234,8 @@ pub struct ReturnTypeImplTraits {
238 pub(crate) impl_traits: Vec<ReturnTypeImplTrait>, 234 pub(crate) impl_traits: Vec<ReturnTypeImplTrait>,
239} 235}
240 236
237has_interner!(ReturnTypeImplTraits);
238
241#[derive(Clone, PartialEq, Eq, Debug, Hash)] 239#[derive(Clone, PartialEq, Eq, Debug, Hash)]
242pub(crate) struct ReturnTypeImplTrait { 240pub(crate) struct ReturnTypeImplTrait {
243 pub(crate) bounds: Binders<Vec<QuantifiedWhereClause>>, 241 pub(crate) bounds: Binders<Vec<QuantifiedWhereClause>>,