pub struct InferenceResult<'db> {
pub mutated_bindings_in_closure: FxHashSet<BindingId>,
/* private fields */
}Expand description
The result of type inference: A mapping from expressions and patterns to types.
When you add a field that stores types (including Substitution and the like), don’t forget
resolve_completely()’ing them in InferenceContext::resolve_all(). Inference variables must
not appear in the final inference result.
Fields§
§mutated_bindings_in_closure: FxHashSet<BindingId>Implementations§
Source§impl<'db> InferenceResult<'db>
impl<'db> InferenceResult<'db>
pub fn for_body( db: &'db dyn HirDatabase, def: DefWithBodyId, ) -> &'db InferenceResult<'db>
Source§impl<'db> InferenceResult<'db>
impl<'db> InferenceResult<'db>
pub fn method_resolution( &self, expr: ExprId, ) -> Option<(FunctionId, GenericArgs<'db>)>
pub fn field_resolution( &self, expr: ExprId, ) -> Option<Either<FieldId, TupleFieldId>>
pub fn variant_resolution_for_expr(&self, id: ExprId) -> Option<VariantId>
pub fn variant_resolution_for_pat(&self, id: PatId) -> Option<VariantId>
pub fn variant_resolution_for_expr_or_pat( &self, id: ExprOrPatId, ) -> Option<VariantId>
pub fn assoc_resolutions_for_expr( &self, id: ExprId, ) -> Option<(CandidateId, GenericArgs<'db>)>
pub fn assoc_resolutions_for_pat( &self, id: PatId, ) -> Option<(CandidateId, GenericArgs<'db>)>
pub fn assoc_resolutions_for_expr_or_pat( &self, id: ExprOrPatId, ) -> Option<(CandidateId, GenericArgs<'db>)>
pub fn type_mismatch_for_expr(&self, expr: ExprId) -> Option<&TypeMismatch<'db>>
pub fn type_mismatch_for_pat(&self, pat: PatId) -> Option<&TypeMismatch<'db>>
pub fn type_mismatches( &self, ) -> impl Iterator<Item = (ExprOrPatId, &TypeMismatch<'db>)>
pub fn expr_type_mismatches( &self, ) -> impl Iterator<Item = (ExprId, &TypeMismatch<'db>)>
pub fn placeholder_types(&self) -> impl Iterator<Item = (TypeRefId, &Ty<'db>)>
pub fn type_of_type_placeholder(&self, type_ref: TypeRefId) -> Option<Ty<'db>>
pub fn closure_info( &self, closure: InternedClosureId, ) -> &(Vec<CapturedItem<'db>>, FnTrait)
pub fn type_of_expr_or_pat(&self, id: ExprOrPatId) -> Option<Ty<'db>>
pub fn type_of_expr_with_adjust(&self, id: ExprId) -> Option<Ty<'db>>
pub fn type_of_pat_with_adjust(&self, id: PatId) -> Option<Ty<'db>>
pub fn is_erroneous(&self) -> bool
pub fn diagnostics(&self) -> &[InferenceDiagnostic<'db>]
pub fn tuple_field_access_type(&self, id: TupleId) -> Tys<'db>
pub fn pat_adjustment(&self, id: PatId) -> Option<&[Ty<'db>]>
pub fn expr_adjustment(&self, id: ExprId) -> Option<&[Adjustment<'db>]>
pub fn binding_mode(&self, id: PatId) -> Option<BindingMode>
pub fn expression_types(&self) -> impl Iterator<Item = (ExprId, Ty<'db>)>
pub fn pattern_types(&self) -> impl Iterator<Item = (PatId, Ty<'db>)>
pub fn binding_types(&self) -> impl Iterator<Item = (BindingId, Ty<'db>)>
pub fn return_position_impl_trait_types( &self, db: &'db dyn HirDatabase, ) -> impl Iterator<Item = (ImplTraitIdx<'db>, Ty<'db>)>
Trait Implementations§
Source§impl<'db> Clone for InferenceResult<'db>
impl<'db> Clone for InferenceResult<'db>
Source§fn clone(&self) -> InferenceResult<'db>
fn clone(&self) -> InferenceResult<'db>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'db> Debug for InferenceResult<'db>
impl<'db> Debug for InferenceResult<'db>
Source§impl<'db> Index<ExprOrPatId> for InferenceResult<'db>
impl<'db> Index<ExprOrPatId> for InferenceResult<'db>
Source§impl<'db> Index<Idx<Binding>> for InferenceResult<'db>
impl<'db> Index<Idx<Binding>> for InferenceResult<'db>
Source§impl<'db> Index<Idx<Expr>> for InferenceResult<'db>
impl<'db> Index<Idx<Expr>> for InferenceResult<'db>
Source§impl<'db> Index<Idx<Pat>> for InferenceResult<'db>
impl<'db> Index<Idx<Pat>> for InferenceResult<'db>
Source§impl<'db> PartialEq for InferenceResult<'db>
impl<'db> PartialEq for InferenceResult<'db>
Source§impl<'db> Update for InferenceResult<'db>
impl<'db> Update for InferenceResult<'db>
impl<'db> Eq for InferenceResult<'db>
impl<'db> StructuralPartialEq for InferenceResult<'db>
Auto Trait Implementations§
impl<'db> Freeze for InferenceResult<'db>
impl<'db> RefUnwindSafe for InferenceResult<'db>
impl<'db> Send for InferenceResult<'db>
impl<'db> Sync for InferenceResult<'db>
impl<'db> Unpin for InferenceResult<'db>
impl<'db> UnwindSafe for InferenceResult<'db>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T, R> CollectAndApply<T, R> for T
impl<T, R> CollectAndApply<T, R> for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more