aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir_ty/src/traits.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir_ty/src/traits.rs')
-rw-r--r--crates/ra_hir_ty/src/traits.rs51
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
4use chalk_ir::cast::Cast; 4use chalk_ir::cast::Cast;
5use chalk_solve::Solver; 5use chalk_solve::Solver;
6use hir_def::{ 6use hir_def::{lang_item::LangItemTarget, TraitId};
7 expr::ExprId, lang_item::LangItemTarget, DefWithBodyId, ImplId, TraitId, TypeAliasId, 7use ra_db::CrateId;
8};
9use ra_db::{impl_intern_key, salsa, CrateId};
10use ra_prof::profile; 8use ra_prof::profile;
11 9
12use crate::{db::HirDatabase, DebruijnIndex, Substs}; 10use crate::{db::HirDatabase, DebruijnIndex, Substs};
@@ -16,7 +14,6 @@ use super::{Canonical, GenericPredicate, HirDisplay, ProjectionTy, TraitRef, Ty,
16use self::chalk::{from_chalk, Interner, ToChalk}; 14use self::chalk::{from_chalk, Interner, ToChalk};
17 15
18pub(crate) mod chalk; 16pub(crate) mod chalk;
19mod 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)]
279pub struct ClosureFnTraitImplData {
280 def: DefWithBodyId,
281 expr: ExprId,
282 fn_trait: FnTrait,
283}
284
285#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
286pub 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)]
294pub 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)]
303pub struct GlobalImplId(salsa::InternId);
304impl_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)]
310pub 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)]
319pub struct AssocTyValueId(salsa::InternId);
320impl_intern_key!(AssocTyValueId);