diff options
Diffstat (limited to 'crates')
-rw-r--r-- | crates/hir_ty/src/chalk_cast.rs | 16 | ||||
-rw-r--r-- | crates/hir_ty/src/interner.rs | 9 | ||||
-rw-r--r-- | crates/hir_ty/src/lib.rs | 42 |
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 | |||
3 | use chalk_ir::interner::HasInterner; | ||
4 | |||
5 | use crate::{CallableSig, ReturnTypeImplTraits}; | ||
6 | |||
7 | macro_rules! has_interner { | ||
8 | ($t:ty) => { | ||
9 | impl HasInterner for $t { | ||
10 | type Interner = crate::Interner; | ||
11 | } | ||
12 | }; | ||
13 | } | ||
14 | |||
15 | has_interner!(CallableSig); | ||
16 | has_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 { | |||
412 | impl chalk_ir::interner::HasInterner for Interner { | 412 | impl chalk_ir::interner::HasInterner for Interner { |
413 | type Interner = Self; | 413 | type Interner = Self; |
414 | } | 414 | } |
415 | |||
416 | #[macro_export] | ||
417 | macro_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 | ||
9 | mod autoderef; | 9 | mod autoderef; |
10 | pub mod primitive; | ||
11 | pub mod traits; | ||
12 | pub mod method_resolution; | ||
13 | mod op; | ||
14 | mod lower; | ||
15 | pub(crate) mod infer; | ||
16 | pub(crate) mod utils; | ||
17 | mod chalk_cast; | ||
18 | mod chalk_ext; | ||
19 | mod builder; | 10 | mod builder; |
20 | mod walk; | 11 | mod chalk_db; |
21 | mod tls; | 12 | mod chalk_ext; |
13 | mod infer; | ||
22 | mod interner; | 14 | mod interner; |
15 | mod lower; | ||
23 | mod mapping; | 16 | mod mapping; |
24 | mod chalk_db; | 17 | mod op; |
25 | 18 | mod tls; | |
26 | pub mod display; | 19 | mod utils; |
20 | mod walk; | ||
27 | pub mod db; | 21 | pub mod db; |
28 | pub mod diagnostics; | 22 | pub mod diagnostics; |
23 | pub mod display; | ||
24 | pub mod method_resolution; | ||
25 | pub mod primitive; | ||
26 | pub mod traits; | ||
29 | 27 | ||
30 | #[cfg(test)] | 28 | #[cfg(test)] |
31 | mod tests; | 29 | mod tests; |
@@ -100,6 +98,10 @@ pub type ConstValue = chalk_ir::ConstValue<Interner>; | |||
100 | pub type ConcreteConst = chalk_ir::ConcreteConst<Interner>; | 98 | pub type ConcreteConst = chalk_ir::ConcreteConst<Interner>; |
101 | 99 | ||
102 | pub type ChalkTraitId = chalk_ir::TraitId<Interner>; | 100 | pub type ChalkTraitId = chalk_ir::TraitId<Interner>; |
101 | pub type TraitRef = chalk_ir::TraitRef<Interner>; | ||
102 | pub type QuantifiedWhereClause = Binders<WhereClause>; | ||
103 | pub type QuantifiedWhereClauses = chalk_ir::QuantifiedWhereClauses<Interner>; | ||
104 | pub type Canonical<T> = chalk_ir::Canonical<T>; | ||
103 | 105 | ||
104 | pub type FnSig = chalk_ir::FnSig<Interner>; | 106 | pub 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 | ||
162 | pub type TraitRef = chalk_ir::TraitRef<Interner>; | ||
163 | |||
164 | pub type QuantifiedWhereClause = Binders<WhereClause>; | ||
165 | |||
166 | pub type QuantifiedWhereClauses = chalk_ir::QuantifiedWhereClauses<Interner>; | ||
167 | |||
168 | pub 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 | ||
172 | has_interner!(CallableSig); | ||
173 | |||
178 | /// A polymorphic function signature. | 174 | /// A polymorphic function signature. |
179 | pub type PolyFnSig = Binders<CallableSig>; | 175 | pub 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 | ||
237 | has_interner!(ReturnTypeImplTraits); | ||
238 | |||
241 | #[derive(Clone, PartialEq, Eq, Debug, Hash)] | 239 | #[derive(Clone, PartialEq, Eq, Debug, Hash)] |
242 | pub(crate) struct ReturnTypeImplTrait { | 240 | pub(crate) struct ReturnTypeImplTrait { |
243 | pub(crate) bounds: Binders<Vec<QuantifiedWhereClause>>, | 241 | pub(crate) bounds: Binders<Vec<QuantifiedWhereClause>>, |