[−][src]Trait chalk_solve::RustIrDatabase
Trait representing access to a database of rust types.
*_name
methods
This trait has a number of *_name
methods with default implementations.
These are used in the implementation for LoggingRustIrDatabase
, so that
when printing .chalk
files equivalent to the data used, we can use real
names.
The default implementations simply fall back to calling Interner
debug
methods, and printing "UnknownN"
(where N
is the demultiplexing integer)
if those methods return None
.
The display::sanitize_debug_name
utility is used in the default
implementations, and might be useful when providing custom implementations.
Required methods
pub fn custom_clauses(&self) -> Vec<ProgramClause<I>>
[src]
Returns any "custom program clauses" that do not derive from Rust IR. Used only in testing the underlying solver.
pub fn associated_ty_data(
&self,
ty: AssocTypeId<I>
) -> Arc<AssociatedTyDatum<I>>
[src]
&self,
ty: AssocTypeId<I>
) -> Arc<AssociatedTyDatum<I>>
Returns the datum for the associated type with the given id.
pub fn trait_datum(&self, trait_id: TraitId<I>) -> Arc<TraitDatum<I>>
[src]
Returns the datum for the definition with the given id.
pub fn adt_datum(&self, adt_id: AdtId<I>) -> Arc<AdtDatum<I>>
[src]
Returns the datum for the ADT with the given id.
pub fn generator_datum(
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorDatum<I>>
[src]
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorDatum<I>>
Returns the generator datum for the generator with the given id.
pub fn generator_witness_datum(
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorWitnessDatum<I>>
[src]
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorWitnessDatum<I>>
Returns the generator witness datum for the generator with the given id.
pub fn adt_repr(&self, id: AdtId<I>) -> Arc<AdtRepr<I>>
[src]
Returns the representation for the ADT definition with the given id.
pub fn fn_def_datum(&self, fn_def_id: FnDefId<I>) -> Arc<FnDefDatum<I>>
[src]
Returns the datum for the fn definition with the given id.
pub fn impl_datum(&self, impl_id: ImplId<I>) -> Arc<ImplDatum<I>>
[src]
Returns the datum for the impl with the given id.
pub fn associated_ty_value(
&self,
id: AssociatedTyValueId<I>
) -> Arc<AssociatedTyValue<I>>
[src]
&self,
id: AssociatedTyValueId<I>
) -> Arc<AssociatedTyValue<I>>
Returns the AssociatedTyValue
with the given id.
pub fn opaque_ty_data(&self, id: OpaqueTyId<I>) -> Arc<OpaqueTyDatum<I>>
[src]
Returns the OpaqueTyDatum
with the given id.
pub fn hidden_opaque_type(&self, id: OpaqueTyId<I>) -> Ty<I>
[src]
Returns the "hidden type" corresponding with the opaque type.
pub fn impls_for_trait(
&self,
trait_id: TraitId<I>,
parameters: &[GenericArg<I>],
binders: &CanonicalVarKinds<I>
) -> Vec<ImplId<I>>
[src]
&self,
trait_id: TraitId<I>,
parameters: &[GenericArg<I>],
binders: &CanonicalVarKinds<I>
) -> Vec<ImplId<I>>
Returns a list of potentially relevant impls for a given trait-id; we also supply the type parameters that we are trying to match (if known: these parameters may contain inference variables, for example). The implementor is permitted to return any superset of the applicable impls; chalk will narrow down the list to only those that truly apply. The parameters are provided as a "hint" to help the implementor do less work, but can be completely ignored if desired.
The binders
are for the parameters
; if the recursive solver is used,
the parameters can contain bound variables referring to these binders.
pub fn local_impls_to_coherence_check(
&self,
trait_id: TraitId<I>
) -> Vec<ImplId<I>>
[src]
&self,
trait_id: TraitId<I>
) -> Vec<ImplId<I>>
Returns the impls that require coherence checking. This is not the full set of impls that exist:
- It can exclude impls not defined in the current crate.
- It can exclude "built-in" impls, like those for closures; only the impls actually written by users need to be checked.
pub fn impl_provided_for(
&self,
auto_trait_id: TraitId<I>,
ty: &TyKind<I>
) -> bool
[src]
&self,
auto_trait_id: TraitId<I>,
ty: &TyKind<I>
) -> bool
Returns true if there is an explicit impl of the auto trait
auto_trait_id
for the type ty
. This is part of
the auto trait handling -- if there is no explicit impl given
by the user for ty
, then we provide default impls
(otherwise, we rely on the impls the user gave).
pub fn well_known_trait_id(
&self,
well_known_trait: WellKnownTrait
) -> Option<TraitId<I>>
[src]
&self,
well_known_trait: WellKnownTrait
) -> Option<TraitId<I>>
Returns id of a trait lang item, if found
pub fn program_clauses_for_env(
&self,
environment: &Environment<I>
) -> ProgramClauses<I>
[src]
&self,
environment: &Environment<I>
) -> ProgramClauses<I>
Calculates program clauses from an env. This is intended to call the
program_clauses_for_env
function and then possibly cache the clauses.
pub fn interner(&self) -> &I
[src]
pub fn is_object_safe(&self, trait_id: TraitId<I>) -> bool
[src]
Check if a trait is object safe
pub fn closure_kind(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> ClosureKind
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> ClosureKind
Gets the ClosureKind
for a given closure and substitution.
pub fn closure_inputs_and_output(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<FnDefInputsAndOutputDatum<I>>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<FnDefInputsAndOutputDatum<I>>
Gets the inputs and output for a given closure id and substitution. We
pass both the ClosureId
and it's Substituion
to give implementors
the freedom to store associated data in the substitution (like rustc) or
separately (like chalk-integration).
pub fn closure_upvars(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<Ty<I>>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<Ty<I>>
Gets the upvars as a Ty
for a given closure id and substitution. There
are no restrictions on the type of upvars.
pub fn closure_fn_substitution(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Substitution<I>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Substitution<I>
Gets the substitution for the closure when used as a function. For example, for the following (not-quite-)rust code:
let foo = |a: &mut u32| { a += 1; }; let c: &'a u32 = &0; foo(c);
This would return a Substitution
of [&'a]
. This could either be
substituted into the inputs and output, or into the upvars.
pub fn unification_database(&self) -> &dyn UnificationDatabase<I>
[src]
pub fn discriminant_type(&self, ty: Ty<I>) -> Ty<I>
[src]
Provided methods
pub fn trait_name(&self, trait_id: TraitId<I>) -> String
[src]
Retrieves a trait's original name. No uniqueness guarantees, but must a valid Rust identifier.
pub fn adt_name(&self, adt_id: AdtId<I>) -> String
[src]
Retrieves a struct's original name. No uniqueness guarantees, but must a valid Rust identifier.
pub fn assoc_type_name(&self, assoc_ty_id: AssocTypeId<I>) -> String
[src]
Retrieves the name of an associated type. No uniqueness guarantees, but must a valid Rust identifier.
pub fn opaque_type_name(&self, opaque_ty_id: OpaqueTyId<I>) -> String
[src]
Retrieves the name of an opaque type. No uniqueness guarantees, but must a valid Rust identifier.
pub fn fn_def_name(&self, fn_def_id: FnDefId<I>) -> String
[src]
Retrieves the name of a function definition. No uniqueness guarantees, but must a valid Rust identifier.
Implementors
impl<I, DB, P> RustIrDatabase<I> for LoggingRustIrDatabase<I, DB, P> where
DB: RustIrDatabase<I>,
P: Borrow<DB> + Debug,
I: Interner,
[src]
DB: RustIrDatabase<I>,
P: Borrow<DB> + Debug,
I: Interner,
pub fn custom_clauses(&self) -> Vec<ProgramClause<I>>
[src]
pub fn associated_ty_data(
&self,
ty: AssocTypeId<I>
) -> Arc<AssociatedTyDatum<I>>
[src]
&self,
ty: AssocTypeId<I>
) -> Arc<AssociatedTyDatum<I>>
pub fn trait_datum(&self, trait_id: TraitId<I>) -> Arc<TraitDatum<I>>
[src]
pub fn adt_datum(&self, adt_id: AdtId<I>) -> Arc<AdtDatum<I>>
[src]
pub fn generator_datum(
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorDatum<I>>
[src]
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorDatum<I>>
pub fn generator_witness_datum(
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorWitnessDatum<I>>
[src]
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorWitnessDatum<I>>
pub fn adt_repr(&self, id: AdtId<I>) -> Arc<AdtRepr<I>>
[src]
pub fn impl_datum(&self, impl_id: ImplId<I>) -> Arc<ImplDatum<I>>
[src]
pub fn hidden_opaque_type(&self, id: OpaqueTyId<I>) -> Ty<I>
[src]
pub fn associated_ty_value(
&self,
id: AssociatedTyValueId<I>
) -> Arc<AssociatedTyValue<I>>
[src]
&self,
id: AssociatedTyValueId<I>
) -> Arc<AssociatedTyValue<I>>
pub fn opaque_ty_data(&self, id: OpaqueTyId<I>) -> Arc<OpaqueTyDatum<I>>
[src]
pub fn impls_for_trait(
&self,
trait_id: TraitId<I>,
parameters: &[GenericArg<I>],
binders: &CanonicalVarKinds<I>
) -> Vec<ImplId<I>>
[src]
&self,
trait_id: TraitId<I>,
parameters: &[GenericArg<I>],
binders: &CanonicalVarKinds<I>
) -> Vec<ImplId<I>>
pub fn local_impls_to_coherence_check(
&self,
trait_id: TraitId<I>
) -> Vec<ImplId<I>>
[src]
&self,
trait_id: TraitId<I>
) -> Vec<ImplId<I>>
pub fn impl_provided_for(
&self,
auto_trait_id: TraitId<I>,
ty: &TyKind<I>
) -> bool
[src]
&self,
auto_trait_id: TraitId<I>,
ty: &TyKind<I>
) -> bool
pub fn well_known_trait_id(
&self,
well_known_trait: WellKnownTrait
) -> Option<TraitId<I>>
[src]
&self,
well_known_trait: WellKnownTrait
) -> Option<TraitId<I>>
pub fn program_clauses_for_env(
&self,
environment: &Environment<I>
) -> ProgramClauses<I>
[src]
&self,
environment: &Environment<I>
) -> ProgramClauses<I>
pub fn interner(&self) -> &I
[src]
pub fn trait_name(&self, trait_id: TraitId<I>) -> String
[src]
pub fn adt_name(&self, adt_id: AdtId<I>) -> String
[src]
pub fn assoc_type_name(&self, assoc_ty_id: AssocTypeId<I>) -> String
[src]
pub fn opaque_type_name(&self, opaque_ty_id: OpaqueTyId<I>) -> String
[src]
pub fn is_object_safe(&self, trait_id: TraitId<I>) -> bool
[src]
pub fn fn_def_datum(&self, fn_def_id: FnDefId<I>) -> Arc<FnDefDatum<I>>
[src]
pub fn fn_def_name(&self, fn_def_id: FnDefId<I>) -> String
[src]
pub fn closure_kind(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> ClosureKind
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> ClosureKind
pub fn closure_inputs_and_output(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<FnDefInputsAndOutputDatum<I>>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<FnDefInputsAndOutputDatum<I>>
pub fn closure_upvars(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<Ty<I>>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<Ty<I>>
pub fn closure_fn_substitution(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Substitution<I>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Substitution<I>
pub fn discriminant_type(&self, ty: Ty<I>) -> Ty<I>
[src]
pub fn unification_database(&self) -> &dyn UnificationDatabase<I>
[src]
impl<I, W, DB, P> RustIrDatabase<I> for WriteOnDropRustIrDatabase<I, W, DB, P> where
I: Interner,
W: Write,
DB: RustIrDatabase<I>,
P: Borrow<DB> + Debug,
[src]
I: Interner,
W: Write,
DB: RustIrDatabase<I>,
P: Borrow<DB> + Debug,
pub fn custom_clauses(&self) -> Vec<ProgramClause<I>>
[src]
pub fn associated_ty_data(
&self,
ty: AssocTypeId<I>
) -> Arc<AssociatedTyDatum<I>>
[src]
&self,
ty: AssocTypeId<I>
) -> Arc<AssociatedTyDatum<I>>
pub fn trait_datum(&self, trait_id: TraitId<I>) -> Arc<TraitDatum<I>>
[src]
pub fn adt_datum(&self, adt_id: AdtId<I>) -> Arc<AdtDatum<I>>
[src]
pub fn generator_datum(
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorDatum<I>>
[src]
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorDatum<I>>
pub fn generator_witness_datum(
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorWitnessDatum<I>>
[src]
&self,
generator_id: GeneratorId<I>
) -> Arc<GeneratorWitnessDatum<I>>
Returns the generator witness datum for the generator with the given id.
pub fn adt_repr(&self, id: AdtId<I>) -> Arc<AdtRepr<I>>
[src]
pub fn impl_datum(&self, impl_id: ImplId<I>) -> Arc<ImplDatum<I>>
[src]
pub fn associated_ty_value(
&self,
id: AssociatedTyValueId<I>
) -> Arc<AssociatedTyValue<I>>
[src]
&self,
id: AssociatedTyValueId<I>
) -> Arc<AssociatedTyValue<I>>
pub fn opaque_ty_data(&self, id: OpaqueTyId<I>) -> Arc<OpaqueTyDatum<I>>
[src]
pub fn hidden_opaque_type(&self, id: OpaqueTyId<I>) -> Ty<I>
[src]
pub fn impls_for_trait(
&self,
trait_id: TraitId<I>,
parameters: &[GenericArg<I>],
binders: &CanonicalVarKinds<I>
) -> Vec<ImplId<I>>
[src]
&self,
trait_id: TraitId<I>,
parameters: &[GenericArg<I>],
binders: &CanonicalVarKinds<I>
) -> Vec<ImplId<I>>
pub fn local_impls_to_coherence_check(
&self,
trait_id: TraitId<I>
) -> Vec<ImplId<I>>
[src]
&self,
trait_id: TraitId<I>
) -> Vec<ImplId<I>>
pub fn impl_provided_for(
&self,
auto_trait_id: TraitId<I>,
ty: &TyKind<I>
) -> bool
[src]
&self,
auto_trait_id: TraitId<I>,
ty: &TyKind<I>
) -> bool
pub fn well_known_trait_id(
&self,
well_known_trait: WellKnownTrait
) -> Option<TraitId<I>>
[src]
&self,
well_known_trait: WellKnownTrait
) -> Option<TraitId<I>>
pub fn program_clauses_for_env(
&self,
environment: &Environment<I>
) -> ProgramClauses<I>
[src]
&self,
environment: &Environment<I>
) -> ProgramClauses<I>
pub fn interner(&self) -> &I
[src]
pub fn is_object_safe(&self, trait_id: TraitId<I>) -> bool
[src]
pub fn unification_database(&self) -> &dyn UnificationDatabase<I>
[src]
pub fn trait_name(&self, trait_id: TraitId<I>) -> String
[src]
pub fn adt_name(&self, adt_id: AdtId<I>) -> String
[src]
pub fn assoc_type_name(&self, assoc_ty_id: AssocTypeId<I>) -> String
[src]
pub fn opaque_type_name(&self, opaque_ty_id: OpaqueTyId<I>) -> String
[src]
pub fn fn_def_datum(&self, fn_def_id: FnDefId<I>) -> Arc<FnDefDatum<I>>
[src]
pub fn fn_def_name(&self, fn_def_id: FnDefId<I>) -> String
[src]
pub fn closure_kind(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> ClosureKind
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> ClosureKind
pub fn closure_inputs_and_output(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<FnDefInputsAndOutputDatum<I>>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<FnDefInputsAndOutputDatum<I>>
pub fn closure_upvars(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<Ty<I>>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Binders<Ty<I>>
pub fn closure_fn_substitution(
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Substitution<I>
[src]
&self,
closure_id: ClosureId<I>,
substs: &Substitution<I>
) -> Substitution<I>