2021-04-09 12:39:07 +00:00
|
|
|
//! The home of `HirDatabase`, which is the Salsa database containing all the
|
|
|
|
//! type inference-related queries.
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2023-05-02 14:12:22 +00:00
|
|
|
use std::sync;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-02-10 14:36:26 +00:00
|
|
|
use base_db::{
|
|
|
|
impl_intern_key,
|
2024-10-04 19:48:11 +00:00
|
|
|
ra_salsa::{self, InternValueTrivial},
|
2024-02-10 14:36:26 +00:00
|
|
|
CrateId, Upcast,
|
|
|
|
};
|
2019-11-27 14:46:02 +00:00
|
|
|
use hir_def::{
|
2024-06-23 13:22:42 +00:00
|
|
|
db::DefDatabase, hir::ExprId, layout::TargetDataLayout, AdtId, BlockId, CallableDefId,
|
|
|
|
ConstParamId, DefWithBodyId, EnumVariantId, FunctionId, GeneralConstId, GenericDefId, ImplId,
|
2024-08-06 18:16:24 +00:00
|
|
|
LifetimeParamId, LocalFieldId, StaticId, TraitId, TypeAliasId, TypeOrConstParamId, VariantId,
|
2019-11-27 14:46:02 +00:00
|
|
|
};
|
2021-01-15 00:11:07 +00:00
|
|
|
use la_arena::ArenaMap;
|
2022-12-04 19:12:11 +00:00
|
|
|
use smallvec::SmallVec;
|
2023-05-02 14:12:22 +00:00
|
|
|
use triomphe::Arc;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2021-04-09 12:15:26 +00:00
|
|
|
use crate::{
|
|
|
|
chalk_db,
|
2023-02-03 11:16:25 +00:00
|
|
|
consteval::ConstEvalError,
|
2024-09-28 11:01:32 +00:00
|
|
|
dyn_compatibility::DynCompatibilityViolation,
|
2023-04-16 10:21:12 +00:00
|
|
|
layout::{Layout, LayoutError},
|
2024-06-21 17:09:43 +00:00
|
|
|
lower::{GenericDefaults, GenericPredicates},
|
2022-04-02 13:32:40 +00:00
|
|
|
method_resolution::{InherentImpls, TraitImpls, TyFingerprint},
|
2023-02-26 12:34:41 +00:00
|
|
|
mir::{BorrowckResult, MirBody, MirLowerError},
|
2024-06-23 13:22:42 +00:00
|
|
|
Binders, ClosureId, Const, FnDefId, ImplTraitId, ImplTraits, InferenceResult, Interner,
|
|
|
|
PolyFnSig, Substitution, TraitEnvironment, TraitRef, Ty, TyDefId, ValueTyDefId,
|
2021-04-09 12:15:26 +00:00
|
|
|
};
|
2020-03-06 16:23:08 +00:00
|
|
|
use hir_expand::name::Name;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::query_group(HirDatabaseStorage)]
|
2020-03-13 15:05:46 +00:00
|
|
|
pub trait HirDatabase: DefDatabase + Upcast<dyn DefDatabase> {
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::infer::infer_query)]
|
2024-03-06 18:11:40 +00:00
|
|
|
fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>;
|
2020-01-03 16:02:08 +00:00
|
|
|
|
2024-01-09 20:20:03 +00:00
|
|
|
// region:mir
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::mir::mir_body_query)]
|
|
|
|
#[ra_salsa::cycle(crate::mir::mir_body_recover)]
|
2023-02-03 11:16:25 +00:00
|
|
|
fn mir_body(&self, def: DefWithBodyId) -> Result<Arc<MirBody>, MirLowerError>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::mir::mir_body_for_closure_query)]
|
2023-04-06 12:44:38 +00:00
|
|
|
fn mir_body_for_closure(&self, def: ClosureId) -> Result<Arc<MirBody>, MirLowerError>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::mir::monomorphized_mir_body_query)]
|
|
|
|
#[ra_salsa::cycle(crate::mir::monomorphized_mir_body_recover)]
|
2023-05-25 21:15:37 +00:00
|
|
|
fn monomorphized_mir_body(
|
|
|
|
&self,
|
|
|
|
def: DefWithBodyId,
|
|
|
|
subst: Substitution,
|
2023-11-14 09:08:19 +00:00
|
|
|
env: Arc<TraitEnvironment>,
|
2023-05-25 21:15:37 +00:00
|
|
|
) -> Result<Arc<MirBody>, MirLowerError>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::mir::monomorphized_mir_body_for_closure_query)]
|
2023-05-25 21:15:37 +00:00
|
|
|
fn monomorphized_mir_body_for_closure(
|
|
|
|
&self,
|
|
|
|
def: ClosureId,
|
|
|
|
subst: Substitution,
|
2023-11-14 09:08:19 +00:00
|
|
|
env: Arc<TraitEnvironment>,
|
2023-05-25 21:15:37 +00:00
|
|
|
) -> Result<Arc<MirBody>, MirLowerError>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::mir::borrowck_query)]
|
|
|
|
#[ra_salsa::lru]
|
2023-04-06 12:44:38 +00:00
|
|
|
fn borrowck(&self, def: DefWithBodyId) -> Result<Arc<[BorrowckResult]>, MirLowerError>;
|
2023-02-26 12:34:41 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::consteval::const_eval_query)]
|
|
|
|
#[ra_salsa::cycle(crate::consteval::const_eval_recover)]
|
2023-07-20 09:38:38 +00:00
|
|
|
fn const_eval(
|
|
|
|
&self,
|
|
|
|
def: GeneralConstId,
|
|
|
|
subst: Substitution,
|
2023-11-14 09:08:19 +00:00
|
|
|
trait_env: Option<Arc<TraitEnvironment>>,
|
2023-07-20 09:38:38 +00:00
|
|
|
) -> Result<Const, ConstEvalError>;
|
2023-05-12 14:47:15 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::consteval::const_eval_static_query)]
|
|
|
|
#[ra_salsa::cycle(crate::consteval::const_eval_static_recover)]
|
2023-05-12 14:47:15 +00:00
|
|
|
fn const_eval_static(&self, def: StaticId) -> Result<Const, ConstEvalError>;
|
2022-03-20 13:45:28 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::consteval::const_eval_discriminant_variant)]
|
|
|
|
#[ra_salsa::cycle(crate::consteval::const_eval_discriminant_recover)]
|
2023-02-03 11:16:25 +00:00
|
|
|
fn const_eval_discriminant(&self, def: EnumVariantId) -> Result<i128, ConstEvalError>;
|
2022-08-06 16:50:21 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::method_resolution::lookup_impl_method_query)]
|
2024-06-23 14:13:01 +00:00
|
|
|
fn lookup_impl_method(
|
|
|
|
&self,
|
|
|
|
env: Arc<TraitEnvironment>,
|
|
|
|
func: FunctionId,
|
|
|
|
fn_subst: Substitution,
|
|
|
|
) -> (FunctionId, Substitution);
|
|
|
|
|
2024-01-09 20:20:03 +00:00
|
|
|
// endregion:mir
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::layout::layout_of_adt_query)]
|
|
|
|
#[ra_salsa::cycle(crate::layout::layout_of_adt_recover)]
|
2024-06-23 14:13:01 +00:00
|
|
|
fn layout_of_adt(
|
|
|
|
&self,
|
|
|
|
def: AdtId,
|
|
|
|
subst: Substitution,
|
|
|
|
env: Arc<TraitEnvironment>,
|
|
|
|
) -> Result<Arc<Layout>, LayoutError>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::layout::layout_of_ty_query)]
|
|
|
|
#[ra_salsa::cycle(crate::layout::layout_of_ty_recover)]
|
2024-06-23 14:13:01 +00:00
|
|
|
fn layout_of_ty(&self, ty: Ty, env: Arc<TraitEnvironment>) -> Result<Arc<Layout>, LayoutError>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::layout::target_data_layout_query)]
|
2024-06-23 14:13:01 +00:00
|
|
|
fn target_data_layout(&self, krate: CrateId) -> Result<Arc<TargetDataLayout>, Arc<str>>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::dyn_compatibility::dyn_compatibility_of_trait_query)]
|
2024-09-28 11:01:32 +00:00
|
|
|
fn dyn_compatibility_of_trait(&self, trait_: TraitId) -> Option<DynCompatibilityViolation>;
|
2024-08-06 18:16:24 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::ty_query)]
|
|
|
|
#[ra_salsa::cycle(crate::lower::ty_recover)]
|
2024-01-09 20:20:03 +00:00
|
|
|
fn ty(&self, def: TyDefId) -> Binders<Ty>;
|
|
|
|
|
2024-02-23 10:45:03 +00:00
|
|
|
/// Returns the type of the value of the given constant, or `None` if the `ValueTyDefId` is
|
2024-01-16 11:09:40 +00:00
|
|
|
/// a `StructId` or `EnumVariantId` with a record constructor.
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::value_ty_query)]
|
2024-01-16 11:09:40 +00:00
|
|
|
fn value_ty(&self, def: ValueTyDefId) -> Option<Binders<Ty>>;
|
2024-01-09 20:20:03 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::impl_self_ty_query)]
|
|
|
|
#[ra_salsa::cycle(crate::lower::impl_self_ty_recover)]
|
2024-01-09 20:20:03 +00:00
|
|
|
fn impl_self_ty(&self, def: ImplId) -> Binders<Ty>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::const_param_ty_query)]
|
2024-01-09 20:20:03 +00:00
|
|
|
fn const_param_ty(&self, def: ConstParamId) -> Ty;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::impl_trait_query)]
|
2020-01-31 15:52:43 +00:00
|
|
|
fn impl_trait(&self, def: ImplId) -> Option<Binders<TraitRef>>;
|
2019-11-27 19:12:09 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::field_types_query)]
|
2020-04-25 12:23:34 +00:00
|
|
|
fn field_types(&self, var: VariantId) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>>;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::callable_item_sig)]
|
2020-07-16 11:15:00 +00:00
|
|
|
fn callable_item_signature(&self, def: CallableDefId) -> PolyFnSig;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::return_type_impl_traits)]
|
2024-03-15 18:31:12 +00:00
|
|
|
fn return_type_impl_traits(&self, def: FunctionId) -> Option<Arc<Binders<ImplTraits>>>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::type_alias_impl_traits)]
|
2024-03-15 18:31:12 +00:00
|
|
|
fn type_alias_impl_traits(&self, def: TypeAliasId) -> Option<Arc<Binders<ImplTraits>>>;
|
2020-03-04 22:00:44 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::generic_predicates_for_param_query)]
|
|
|
|
#[ra_salsa::cycle(crate::lower::generic_predicates_for_param_recover)]
|
2021-03-21 16:40:14 +00:00
|
|
|
fn generic_predicates_for_param(
|
|
|
|
&self,
|
2022-02-03 11:43:15 +00:00
|
|
|
def: GenericDefId,
|
2021-12-29 13:35:59 +00:00
|
|
|
param_id: TypeOrConstParamId,
|
2021-10-04 15:39:55 +00:00
|
|
|
assoc_name: Option<Name>,
|
2024-06-23 13:22:42 +00:00
|
|
|
) -> GenericPredicates;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::generic_predicates_query)]
|
2024-06-21 16:54:58 +00:00
|
|
|
fn generic_predicates(&self, def: GenericDefId) -> GenericPredicates;
|
2024-08-29 17:00:38 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::generic_predicates_without_parent_query)]
|
2024-08-29 17:00:38 +00:00
|
|
|
fn generic_predicates_without_parent(&self, def: GenericDefId) -> GenericPredicates;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::trait_environment_for_body_query)]
|
|
|
|
#[ra_salsa::transparent]
|
2023-11-14 09:08:19 +00:00
|
|
|
fn trait_environment_for_body(&self, def: DefWithBodyId) -> Arc<TraitEnvironment>;
|
2023-03-08 17:28:52 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::trait_environment_query)]
|
2023-11-14 09:08:19 +00:00
|
|
|
fn trait_environment(&self, def: GenericDefId) -> Arc<TraitEnvironment>;
|
2021-03-13 19:38:11 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::lower::generic_defaults_query)]
|
|
|
|
#[ra_salsa::cycle(crate::lower::generic_defaults_recover)]
|
2024-06-21 17:09:43 +00:00
|
|
|
fn generic_defaults(&self, def: GenericDefId) -> GenericDefaults;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(InherentImpls::inherent_impls_in_crate_query)]
|
2020-07-01 15:15:20 +00:00
|
|
|
fn inherent_impls_in_crate(&self, krate: CrateId) -> Arc<InherentImpls>;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(InherentImpls::inherent_impls_in_block_query)]
|
2024-01-09 20:20:03 +00:00
|
|
|
fn inherent_impls_in_block(&self, block: BlockId) -> Option<Arc<InherentImpls>>;
|
2021-11-09 10:13:42 +00:00
|
|
|
|
2022-04-02 13:32:40 +00:00
|
|
|
/// Collects all crates in the dependency graph that have impls for the
|
2022-12-04 19:12:11 +00:00
|
|
|
/// given fingerprint. This is only used for primitive types and types
|
|
|
|
/// annotated with `rustc_has_incoherent_inherent_impls`; for other types
|
|
|
|
/// we just look at the crate where the type is defined.
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::method_resolution::incoherent_inherent_impl_crates)]
|
2022-12-04 19:12:11 +00:00
|
|
|
fn incoherent_inherent_impl_crates(
|
|
|
|
&self,
|
|
|
|
krate: CrateId,
|
|
|
|
fp: TyFingerprint,
|
|
|
|
) -> SmallVec<[CrateId; 2]>;
|
2022-04-02 13:32:40 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(TraitImpls::trait_impls_in_crate_query)]
|
2020-07-01 15:15:20 +00:00
|
|
|
fn trait_impls_in_crate(&self, krate: CrateId) -> Arc<TraitImpls>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(TraitImpls::trait_impls_in_block_query)]
|
2024-01-09 20:20:03 +00:00
|
|
|
fn trait_impls_in_block(&self, block: BlockId) -> Option<Arc<TraitImpls>>;
|
2021-06-13 11:00:34 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(TraitImpls::trait_impls_in_deps_query)]
|
2023-05-02 12:00:18 +00:00
|
|
|
fn trait_impls_in_deps(&self, krate: CrateId) -> Arc<[Arc<TraitImpls>]>;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
|
|
|
// Interned IDs for Chalk integration
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::interned]
|
2020-07-16 11:15:00 +00:00
|
|
|
fn intern_callable_def(&self, callable_def: CallableDefId) -> InternedCallableDefId;
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::interned]
|
2021-12-29 13:35:59 +00:00
|
|
|
fn intern_type_or_const_param_id(
|
|
|
|
&self,
|
|
|
|
param_id: TypeOrConstParamId,
|
|
|
|
) -> InternedTypeOrConstParamId;
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::interned]
|
2021-04-05 18:46:15 +00:00
|
|
|
fn intern_lifetime_param_id(&self, param_id: LifetimeParamId) -> InternedLifetimeParamId;
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::interned]
|
2021-03-13 19:05:47 +00:00
|
|
|
fn intern_impl_trait_id(&self, id: ImplTraitId) -> InternedOpaqueTyId;
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::interned]
|
2024-02-10 14:36:26 +00:00
|
|
|
fn intern_closure(&self, id: InternedClosure) -> InternedClosureId;
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::interned]
|
2024-02-10 14:36:26 +00:00
|
|
|
fn intern_coroutine(&self, id: InternedCoroutine) -> InternedCoroutineId;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::associated_ty_data_query)]
|
2023-05-02 14:12:22 +00:00
|
|
|
fn associated_ty_data(
|
|
|
|
&self,
|
|
|
|
id: chalk_db::AssocTypeId,
|
|
|
|
) -> sync::Arc<chalk_db::AssociatedTyDatum>;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::trait_datum_query)]
|
2023-05-02 14:12:22 +00:00
|
|
|
fn trait_datum(
|
|
|
|
&self,
|
|
|
|
krate: CrateId,
|
|
|
|
trait_id: chalk_db::TraitId,
|
|
|
|
) -> sync::Arc<chalk_db::TraitDatum>;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::adt_datum_query)]
|
2022-08-23 12:56:56 +00:00
|
|
|
fn adt_datum(
|
2021-04-09 12:15:26 +00:00
|
|
|
&self,
|
|
|
|
krate: CrateId,
|
|
|
|
struct_id: chalk_db::AdtId,
|
2022-08-23 12:56:56 +00:00
|
|
|
) -> sync::Arc<chalk_db::AdtDatum>;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::impl_datum_query)]
|
2023-05-02 14:12:22 +00:00
|
|
|
fn impl_datum(
|
|
|
|
&self,
|
|
|
|
krate: CrateId,
|
|
|
|
impl_id: chalk_db::ImplId,
|
|
|
|
) -> sync::Arc<chalk_db::ImplDatum>;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::fn_def_datum_query)]
|
2024-06-23 13:22:42 +00:00
|
|
|
fn fn_def_datum(&self, fn_def_id: FnDefId) -> sync::Arc<chalk_db::FnDefDatum>;
|
2020-11-20 17:00:34 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::fn_def_variance_query)]
|
2021-04-11 09:20:45 +00:00
|
|
|
fn fn_def_variance(&self, fn_def_id: FnDefId) -> chalk_db::Variances;
|
2020-11-20 17:00:34 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::adt_variance_query)]
|
2021-04-11 09:20:45 +00:00
|
|
|
fn adt_variance(&self, adt_id: chalk_db::AdtId) -> chalk_db::Variances;
|
2020-05-22 16:15:53 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::associated_ty_value_query)]
|
2019-11-27 14:46:02 +00:00
|
|
|
fn associated_ty_value(
|
|
|
|
&self,
|
|
|
|
krate: CrateId,
|
2021-04-09 12:11:37 +00:00
|
|
|
id: chalk_db::AssociatedTyValueId,
|
2023-05-02 14:12:22 +00:00
|
|
|
) -> sync::Arc<chalk_db::AssociatedTyValue>;
|
2019-11-27 14:46:02 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::traits::normalize_projection_query)]
|
|
|
|
#[ra_salsa::transparent]
|
2022-09-12 12:56:46 +00:00
|
|
|
fn normalize_projection(
|
|
|
|
&self,
|
|
|
|
projection: crate::ProjectionTy,
|
2023-11-14 09:08:19 +00:00
|
|
|
env: Arc<TraitEnvironment>,
|
2022-09-12 16:52:16 +00:00
|
|
|
) -> Ty;
|
2022-09-12 12:56:46 +00:00
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(crate::traits::trait_solve_query)]
|
2024-03-06 18:11:40 +00:00
|
|
|
fn trait_solve(
|
2021-04-14 16:11:17 +00:00
|
|
|
&self,
|
|
|
|
krate: CrateId,
|
2023-03-28 06:29:07 +00:00
|
|
|
block: Option<BlockId>,
|
2021-05-16 13:50:28 +00:00
|
|
|
goal: crate::Canonical<crate::InEnvironment<crate::Goal>>,
|
2021-04-14 16:11:17 +00:00
|
|
|
) -> Option<crate::Solution>;
|
|
|
|
|
2024-10-04 19:48:11 +00:00
|
|
|
#[ra_salsa::invoke(chalk_db::program_clauses_for_chalk_env_query)]
|
2020-04-18 11:36:35 +00:00
|
|
|
fn program_clauses_for_chalk_env(
|
|
|
|
&self,
|
|
|
|
krate: CrateId,
|
2023-03-28 06:29:07 +00:00
|
|
|
block: Option<BlockId>,
|
2021-04-09 12:11:37 +00:00
|
|
|
env: chalk_ir::Environment<Interner>,
|
|
|
|
) -> chalk_ir::ProgramClauses<Interner>;
|
2019-11-27 14:46:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#[test]
|
2024-09-28 11:01:32 +00:00
|
|
|
fn hir_database_is_dyn_compatible() {
|
|
|
|
fn _assert_dyn_compatible(_: &dyn HirDatabase) {}
|
2019-11-27 14:46:02 +00:00
|
|
|
}
|
2020-01-31 15:52:43 +00:00
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
2024-10-04 19:48:11 +00:00
|
|
|
pub struct InternedTypeOrConstParamId(ra_salsa::InternId);
|
2021-12-29 13:35:59 +00:00
|
|
|
impl_intern_key!(InternedTypeOrConstParamId);
|
2020-03-04 22:00:44 +00:00
|
|
|
|
2021-04-05 18:46:15 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
2024-10-04 19:48:11 +00:00
|
|
|
pub struct InternedLifetimeParamId(ra_salsa::InternId);
|
2021-04-05 18:46:15 +00:00
|
|
|
impl_intern_key!(InternedLifetimeParamId);
|
|
|
|
|
2021-04-06 09:45:41 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
2024-10-04 19:48:11 +00:00
|
|
|
pub struct InternedConstParamId(ra_salsa::InternId);
|
2021-04-06 09:45:41 +00:00
|
|
|
impl_intern_key!(InternedConstParamId);
|
|
|
|
|
2020-03-04 22:00:44 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
2024-10-04 19:48:11 +00:00
|
|
|
pub struct InternedOpaqueTyId(ra_salsa::InternId);
|
2020-03-04 22:00:44 +00:00
|
|
|
impl_intern_key!(InternedOpaqueTyId);
|
2020-07-12 13:26:02 +00:00
|
|
|
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
2024-10-04 19:48:11 +00:00
|
|
|
pub struct InternedClosureId(ra_salsa::InternId);
|
2021-03-13 18:27:09 +00:00
|
|
|
impl_intern_key!(InternedClosureId);
|
2020-07-16 11:13:17 +00:00
|
|
|
|
2024-02-10 14:36:26 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
|
|
pub struct InternedClosure(pub DefWithBodyId, pub ExprId);
|
2024-06-13 22:38:02 +00:00
|
|
|
|
|
|
|
impl InternValueTrivial for InternedClosure {}
|
2024-02-10 14:36:26 +00:00
|
|
|
|
2022-09-06 08:48:06 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
2024-10-04 19:48:11 +00:00
|
|
|
pub struct InternedCoroutineId(ra_salsa::InternId);
|
2023-12-25 22:12:45 +00:00
|
|
|
impl_intern_key!(InternedCoroutineId);
|
2022-09-06 08:48:06 +00:00
|
|
|
|
2024-02-10 14:36:26 +00:00
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
|
|
|
|
pub struct InternedCoroutine(pub DefWithBodyId, pub ExprId);
|
2024-06-13 22:38:02 +00:00
|
|
|
impl InternValueTrivial for InternedCoroutine {}
|
2024-02-10 14:36:26 +00:00
|
|
|
|
2020-07-16 11:13:17 +00:00
|
|
|
/// This exists just for Chalk, because Chalk just has a single `FnDefId` where
|
|
|
|
/// we have different IDs for struct and enum variant constructors.
|
|
|
|
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd)]
|
2024-10-04 19:48:11 +00:00
|
|
|
pub struct InternedCallableDefId(ra_salsa::InternId);
|
2020-07-16 11:13:17 +00:00
|
|
|
impl_intern_key!(InternedCallableDefId);
|