Trait hir_ty::db::HirDatabase

source ·
pub trait HirDatabase:
    Database
    + HasQueryGroup<HirDatabaseStorage>
    + DefDatabase
    + Upcast<dyn DefDatabase> {
Show 58 methods // Required methods fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>; fn mir_body( &self, def: DefWithBodyId, ) -> Result<Arc<MirBody>, MirLowerError>; fn mir_body_for_closure( &self, def: ClosureId, ) -> Result<Arc<MirBody>, MirLowerError>; fn monomorphized_mir_body( &self, def: DefWithBodyId, subst: Substitution, env: Arc<TraitEnvironment>, ) -> Result<Arc<MirBody>, MirLowerError>; fn monomorphized_mir_body_for_closure( &self, def: ClosureId, subst: Substitution, env: Arc<TraitEnvironment>, ) -> Result<Arc<MirBody>, MirLowerError>; fn borrowck( &self, def: DefWithBodyId, ) -> Result<Arc<[BorrowckResult]>, MirLowerError>; fn const_eval( &self, def: GeneralConstId, subst: Substitution, trait_env: Option<Arc<TraitEnvironment>>, ) -> Result<Const, ConstEvalError>; fn const_eval_static(&self, def: StaticId) -> Result<Const, ConstEvalError>; fn const_eval_discriminant( &self, def: EnumVariantId, ) -> Result<i128, ConstEvalError>; fn lookup_impl_method( &self, env: Arc<TraitEnvironment>, func: FunctionId, fn_subst: Substitution, ) -> (FunctionId, Substitution); fn layout_of_adt( &self, def: AdtId, subst: Substitution, env: Arc<TraitEnvironment>, ) -> Result<Arc<Layout>, LayoutError>; fn layout_of_ty( &self, ty: Ty, env: Arc<TraitEnvironment>, ) -> Result<Arc<Layout>, LayoutError>; fn target_data_layout( &self, krate: CrateId, ) -> Result<Arc<TargetDataLayout>, Arc<str>>; fn dyn_compatibility_of_trait( &self, trait_: TraitId, ) -> Option<DynCompatibilityViolation>; fn ty(&self, def: TyDefId) -> Binders<Ty>; fn value_ty(&self, def: ValueTyDefId) -> Option<Binders<Ty>>; fn impl_self_ty(&self, def: ImplId) -> Binders<Ty>; fn const_param_ty(&self, def: ConstParamId) -> Ty; fn impl_trait(&self, def: ImplId) -> Option<Binders<TraitRef>>; fn field_types( &self, var: VariantId, ) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>>; fn callable_item_signature(&self, def: CallableDefId) -> PolyFnSig; fn return_type_impl_traits( &self, def: FunctionId, ) -> Option<Arc<Binders<ImplTraits>>>; fn type_alias_impl_traits( &self, def: TypeAliasId, ) -> Option<Arc<Binders<ImplTraits>>>; fn generic_predicates_for_param( &self, def: GenericDefId, param_id: TypeOrConstParamId, assoc_name: Option<Name>, ) -> GenericPredicates; fn generic_predicates(&self, def: GenericDefId) -> GenericPredicates; fn generic_predicates_without_parent( &self, def: GenericDefId, ) -> GenericPredicates; fn trait_environment_for_body( &self, def: DefWithBodyId, ) -> Arc<TraitEnvironment>; fn trait_environment(&self, def: GenericDefId) -> Arc<TraitEnvironment>; fn generic_defaults(&self, def: GenericDefId) -> GenericDefaults; fn inherent_impls_in_crate(&self, krate: CrateId) -> Arc<InherentImpls>; fn inherent_impls_in_block( &self, block: BlockId, ) -> Option<Arc<InherentImpls>>; fn incoherent_inherent_impl_crates( &self, krate: CrateId, fp: TyFingerprint, ) -> SmallVec<[CrateId; 2]>; fn trait_impls_in_crate(&self, krate: CrateId) -> Arc<TraitImpls>; fn trait_impls_in_block(&self, block: BlockId) -> Option<Arc<TraitImpls>>; fn trait_impls_in_deps(&self, krate: CrateId) -> Arc<[Arc<TraitImpls>]>; fn intern_callable_def( &self, callable_def: CallableDefId, ) -> InternedCallableDefId; fn lookup_intern_callable_def( &self, key: InternedCallableDefId, ) -> CallableDefId; fn intern_type_or_const_param_id( &self, param_id: TypeOrConstParamId, ) -> InternedTypeOrConstParamId; fn lookup_intern_type_or_const_param_id( &self, key: InternedTypeOrConstParamId, ) -> TypeOrConstParamId; fn intern_lifetime_param_id( &self, param_id: LifetimeParamId, ) -> InternedLifetimeParamId; fn lookup_intern_lifetime_param_id( &self, key: InternedLifetimeParamId, ) -> LifetimeParamId; fn intern_impl_trait_id(&self, id: ImplTraitId) -> InternedOpaqueTyId; fn lookup_intern_impl_trait_id( &self, key: InternedOpaqueTyId, ) -> ImplTraitId; fn intern_closure(&self, id: InternedClosure) -> InternedClosureId; fn lookup_intern_closure(&self, key: InternedClosureId) -> InternedClosure; fn intern_coroutine(&self, id: InternedCoroutine) -> InternedCoroutineId; fn lookup_intern_coroutine( &self, key: InternedCoroutineId, ) -> InternedCoroutine; fn associated_ty_data( &self, id: AssocTypeId<Interner>, ) -> Arc<AssociatedTyDatum<Interner>>; fn trait_datum( &self, krate: CrateId, trait_id: TraitId<Interner>, ) -> Arc<TraitDatum<Interner>>; fn adt_datum( &self, krate: CrateId, struct_id: AdtId<Interner>, ) -> Arc<AdtDatum<Interner>>; fn impl_datum( &self, krate: CrateId, impl_id: ImplId<Interner>, ) -> Arc<ImplDatum<Interner>>; fn fn_def_datum(&self, fn_def_id: FnDefId) -> Arc<FnDefDatum<Interner>>; fn fn_def_variance(&self, fn_def_id: FnDefId) -> Variances<Interner>; fn adt_variance(&self, adt_id: AdtId<Interner>) -> Variances<Interner>; fn associated_ty_value( &self, krate: CrateId, id: AssociatedTyValueId<Interner>, ) -> Arc<AssociatedTyValue<Interner>>; fn normalize_projection( &self, projection: ProjectionTy, env: Arc<TraitEnvironment>, ) -> Ty; fn trait_solve( &self, krate: CrateId, block: Option<BlockId>, goal: Canonical<InEnvironment<Goal>>, ) -> Option<Solution>; fn program_clauses_for_chalk_env( &self, krate: CrateId, block: Option<BlockId>, env: Environment<Interner>, ) -> ProgramClauses<Interner>;
}

Required Methods§

source

fn infer(&self, def: DefWithBodyId) -> Arc<InferenceResult>

source

fn mir_body(&self, def: DefWithBodyId) -> Result<Arc<MirBody>, MirLowerError>

source

fn mir_body_for_closure( &self, def: ClosureId, ) -> Result<Arc<MirBody>, MirLowerError>

source

fn monomorphized_mir_body( &self, def: DefWithBodyId, subst: Substitution, env: Arc<TraitEnvironment>, ) -> Result<Arc<MirBody>, MirLowerError>

source

fn monomorphized_mir_body_for_closure( &self, def: ClosureId, subst: Substitution, env: Arc<TraitEnvironment>, ) -> Result<Arc<MirBody>, MirLowerError>

source

fn borrowck( &self, def: DefWithBodyId, ) -> Result<Arc<[BorrowckResult]>, MirLowerError>

source

fn const_eval( &self, def: GeneralConstId, subst: Substitution, trait_env: Option<Arc<TraitEnvironment>>, ) -> Result<Const, ConstEvalError>

source

fn const_eval_static(&self, def: StaticId) -> Result<Const, ConstEvalError>

source

fn const_eval_discriminant( &self, def: EnumVariantId, ) -> Result<i128, ConstEvalError>

source

fn lookup_impl_method( &self, env: Arc<TraitEnvironment>, func: FunctionId, fn_subst: Substitution, ) -> (FunctionId, Substitution)

source

fn layout_of_adt( &self, def: AdtId, subst: Substitution, env: Arc<TraitEnvironment>, ) -> Result<Arc<Layout>, LayoutError>

source

fn layout_of_ty( &self, ty: Ty, env: Arc<TraitEnvironment>, ) -> Result<Arc<Layout>, LayoutError>

source

fn target_data_layout( &self, krate: CrateId, ) -> Result<Arc<TargetDataLayout>, Arc<str>>

source

fn dyn_compatibility_of_trait( &self, trait_: TraitId, ) -> Option<DynCompatibilityViolation>

source

fn ty(&self, def: TyDefId) -> Binders<Ty>

source

fn value_ty(&self, def: ValueTyDefId) -> Option<Binders<Ty>>

Returns the type of the value of the given constant, or None if the ValueTyDefId is a StructId or EnumVariantId with a record constructor.

source

fn impl_self_ty(&self, def: ImplId) -> Binders<Ty>

source

fn const_param_ty(&self, def: ConstParamId) -> Ty

source

fn impl_trait(&self, def: ImplId) -> Option<Binders<TraitRef>>

source

fn field_types( &self, var: VariantId, ) -> Arc<ArenaMap<LocalFieldId, Binders<Ty>>>

source

fn callable_item_signature(&self, def: CallableDefId) -> PolyFnSig

source

fn return_type_impl_traits( &self, def: FunctionId, ) -> Option<Arc<Binders<ImplTraits>>>

source

fn type_alias_impl_traits( &self, def: TypeAliasId, ) -> Option<Arc<Binders<ImplTraits>>>

source

fn generic_predicates_for_param( &self, def: GenericDefId, param_id: TypeOrConstParamId, assoc_name: Option<Name>, ) -> GenericPredicates

source

fn generic_predicates(&self, def: GenericDefId) -> GenericPredicates

source

fn generic_predicates_without_parent( &self, def: GenericDefId, ) -> GenericPredicates

source

fn trait_environment_for_body( &self, def: DefWithBodyId, ) -> Arc<TraitEnvironment>

source

fn trait_environment(&self, def: GenericDefId) -> Arc<TraitEnvironment>

source

fn generic_defaults(&self, def: GenericDefId) -> GenericDefaults

source

fn inherent_impls_in_crate(&self, krate: CrateId) -> Arc<InherentImpls>

source

fn inherent_impls_in_block(&self, block: BlockId) -> Option<Arc<InherentImpls>>

source

fn incoherent_inherent_impl_crates( &self, krate: CrateId, fp: TyFingerprint, ) -> SmallVec<[CrateId; 2]>

Collects all crates in the dependency graph that have impls for the 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.

source

fn trait_impls_in_crate(&self, krate: CrateId) -> Arc<TraitImpls>

source

fn trait_impls_in_block(&self, block: BlockId) -> Option<Arc<TraitImpls>>

source

fn trait_impls_in_deps(&self, krate: CrateId) -> Arc<[Arc<TraitImpls>]>

source

fn intern_callable_def( &self, callable_def: CallableDefId, ) -> InternedCallableDefId

source

fn lookup_intern_callable_def( &self, key: InternedCallableDefId, ) -> CallableDefId

source

fn intern_type_or_const_param_id( &self, param_id: TypeOrConstParamId, ) -> InternedTypeOrConstParamId

source

fn lookup_intern_type_or_const_param_id( &self, key: InternedTypeOrConstParamId, ) -> TypeOrConstParamId

source

fn intern_lifetime_param_id( &self, param_id: LifetimeParamId, ) -> InternedLifetimeParamId

source

fn lookup_intern_lifetime_param_id( &self, key: InternedLifetimeParamId, ) -> LifetimeParamId

source

fn intern_impl_trait_id(&self, id: ImplTraitId) -> InternedOpaqueTyId

source

fn lookup_intern_impl_trait_id(&self, key: InternedOpaqueTyId) -> ImplTraitId

source

fn intern_closure(&self, id: InternedClosure) -> InternedClosureId

source

fn lookup_intern_closure(&self, key: InternedClosureId) -> InternedClosure

source

fn intern_coroutine(&self, id: InternedCoroutine) -> InternedCoroutineId

source

fn lookup_intern_coroutine(&self, key: InternedCoroutineId) -> InternedCoroutine

source

fn associated_ty_data( &self, id: AssocTypeId<Interner>, ) -> Arc<AssociatedTyDatum<Interner>>

source

fn trait_datum( &self, krate: CrateId, trait_id: TraitId<Interner>, ) -> Arc<TraitDatum<Interner>>

source

fn adt_datum( &self, krate: CrateId, struct_id: AdtId<Interner>, ) -> Arc<AdtDatum<Interner>>

source

fn impl_datum( &self, krate: CrateId, impl_id: ImplId<Interner>, ) -> Arc<ImplDatum<Interner>>

source

fn fn_def_datum(&self, fn_def_id: FnDefId) -> Arc<FnDefDatum<Interner>>

source

fn fn_def_variance(&self, fn_def_id: FnDefId) -> Variances<Interner>

source

fn adt_variance(&self, adt_id: AdtId<Interner>) -> Variances<Interner>

source

fn associated_ty_value( &self, krate: CrateId, id: AssociatedTyValueId<Interner>, ) -> Arc<AssociatedTyValue<Interner>>

source

fn normalize_projection( &self, projection: ProjectionTy, env: Arc<TraitEnvironment>, ) -> Ty

source

fn trait_solve( &self, krate: CrateId, block: Option<BlockId>, goal: Canonical<InEnvironment<Goal>>, ) -> Option<Solution>

source

fn program_clauses_for_chalk_env( &self, krate: CrateId, block: Option<BlockId>, env: Environment<Interner>, ) -> ProgramClauses<Interner>

Trait Implementations§

source§

impl UnificationDatabase<Interner> for &dyn HirDatabase

source§

fn fn_def_variance(&self, fn_def_id: FnDefId<Interner>) -> Variances<Interner>

Gets the variances for the substitution of a fn def
source§

fn adt_variance(&self, adt_id: AdtId<Interner>) -> Variances<Interner>

Gets the variances for the substitution of a adt

Implementors§

source§

impl<DB> HirDatabase for DB
where DB: DefDatabase + Upcast<dyn DefDatabase> + Database + HasQueryGroup<HirDatabaseStorage>,