diff options
Diffstat (limited to 'crates/ra_hir_ty/src/traits.rs')
-rw-r--r-- | crates/ra_hir_ty/src/traits.rs | 51 |
1 files changed, 2 insertions, 49 deletions
diff --git a/crates/ra_hir_ty/src/traits.rs b/crates/ra_hir_ty/src/traits.rs index f7edb4c8b..3f6d2cf35 100644 --- a/crates/ra_hir_ty/src/traits.rs +++ b/crates/ra_hir_ty/src/traits.rs | |||
@@ -3,10 +3,8 @@ use std::sync::Arc; | |||
3 | 3 | ||
4 | use chalk_ir::cast::Cast; | 4 | use chalk_ir::cast::Cast; |
5 | use chalk_solve::Solver; | 5 | use chalk_solve::Solver; |
6 | use hir_def::{ | 6 | use hir_def::{lang_item::LangItemTarget, TraitId}; |
7 | expr::ExprId, lang_item::LangItemTarget, DefWithBodyId, ImplId, TraitId, TypeAliasId, | 7 | use ra_db::CrateId; |
8 | }; | ||
9 | use ra_db::{impl_intern_key, salsa, CrateId}; | ||
10 | use ra_prof::profile; | 8 | use ra_prof::profile; |
11 | 9 | ||
12 | use crate::{db::HirDatabase, DebruijnIndex, Substs}; | 10 | use crate::{db::HirDatabase, DebruijnIndex, Substs}; |
@@ -16,7 +14,6 @@ use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty, | |||
16 | use self::chalk::{from_chalk, Interner, ToChalk}; | 14 | use self::chalk::{from_chalk, Interner, ToChalk}; |
17 | 15 | ||
18 | pub(crate) mod chalk; | 16 | pub(crate) mod chalk; |
19 | mod builtin; | ||
20 | 17 | ||
21 | // This controls the maximum size of types Chalk considers. If we set this too | 18 | // This controls the maximum size of types Chalk considers. If we set this too |
22 | // high, we can run into slow edge cases; if we set it too low, Chalk won't | 19 | // high, we can run into slow edge cases; if we set it too low, Chalk won't |
@@ -274,47 +271,3 @@ impl FnTrait { | |||
274 | } | 271 | } |
275 | } | 272 | } |
276 | } | 273 | } |
277 | |||
278 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
279 | pub struct ClosureFnTraitImplData { | ||
280 | def: DefWithBodyId, | ||
281 | expr: ExprId, | ||
282 | fn_trait: FnTrait, | ||
283 | } | ||
284 | |||
285 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
286 | pub struct UnsizeToSuperTraitObjectData { | ||
287 | trait_: TraitId, | ||
288 | super_trait: TraitId, | ||
289 | } | ||
290 | |||
291 | /// An impl. Usually this comes from an impl block, but some built-in types get | ||
292 | /// synthetic impls. | ||
293 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
294 | pub enum Impl { | ||
295 | /// A normal impl from an impl block. | ||
296 | ImplDef(ImplId), | ||
297 | /// Closure types implement the Fn traits synthetically. | ||
298 | // FIXME: implement closure support from Chalk, remove this | ||
299 | ClosureFnTraitImpl(ClosureFnTraitImplData), | ||
300 | } | ||
301 | /// This exists just for Chalk, because our ImplIds are only unique per module. | ||
302 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
303 | pub struct GlobalImplId(salsa::InternId); | ||
304 | impl_intern_key!(GlobalImplId); | ||
305 | |||
306 | /// An associated type value. Usually this comes from a `type` declaration | ||
307 | /// inside an impl block, but for built-in impls we have to synthesize it. | ||
308 | /// (We only need this because Chalk wants a unique ID for each of these.) | ||
309 | #[derive(Debug, Clone, PartialEq, Eq, Hash)] | ||
310 | pub enum AssocTyValue { | ||
311 | /// A normal assoc type value from an impl block. | ||
312 | TypeAlias(TypeAliasId), | ||
313 | /// The output type of the Fn trait implementation. | ||
314 | ClosureFnTraitImplOutput(ClosureFnTraitImplData), | ||
315 | } | ||
316 | /// This exists just for Chalk, because it needs a unique ID for each associated | ||
317 | /// type value in an impl (even synthetic ones). | ||
318 | #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] | ||
319 | pub struct AssocTyValueId(salsa::InternId); | ||
320 | impl_intern_key!(AssocTyValueId); | ||