pub struct InferenceResult {
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 InferenceResult
impl InferenceResult
pub fn method_resolution( &self, expr: ExprId, ) -> Option<(FunctionId, Substitution)>
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<(AssocItemId, Substitution)>
pub fn assoc_resolutions_for_pat( &self, id: PatId, ) -> Option<(AssocItemId, Substitution)>
pub fn assoc_resolutions_for_expr_or_pat( &self, id: ExprOrPatId, ) -> Option<(AssocItemId, Substitution)>
pub fn type_mismatch_for_expr(&self, expr: ExprId) -> Option<&TypeMismatch>
pub fn type_mismatch_for_pat(&self, pat: PatId) -> Option<&TypeMismatch>
pub fn type_mismatches( &self, ) -> impl Iterator<Item = (ExprOrPatId, &TypeMismatch)>
pub fn expr_type_mismatches( &self, ) -> impl Iterator<Item = (ExprId, &TypeMismatch)>
pub fn closure_info(&self, closure: &ClosureId) -> &(Vec<CapturedItem>, FnTrait)
pub fn type_of_expr_or_pat(&self, id: ExprOrPatId) -> Option<&Ty>
pub fn type_of_expr_with_adjust(&self, id: ExprId) -> Option<&Ty>
pub fn type_of_pat_with_adjust(&self, id: PatId) -> Option<&Ty>
pub fn is_erroneous(&self) -> bool
pub fn diagnostics(&self) -> &[InferenceDiagnostic]
pub fn tuple_field_access_type(&self, id: TupleId) -> &Substitution
pub fn pat_adjustment(&self, id: PatId) -> Option<&[Ty]>
pub fn expr_adjustment(&self, id: ExprId) -> Option<&[Adjustment]>
pub fn binding_mode(&self, id: PatId) -> Option<BindingMode>
Trait Implementations§
Source§impl Clone for InferenceResult
impl Clone for InferenceResult
Source§fn clone(&self) -> InferenceResult
fn clone(&self) -> InferenceResult
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 Debug for InferenceResult
impl Debug for InferenceResult
Source§impl Default for InferenceResult
impl Default for InferenceResult
Source§fn default() -> InferenceResult
fn default() -> InferenceResult
Returns the “default value” for a type. Read more
Source§impl Index<ExprOrPatId> for InferenceResult
impl Index<ExprOrPatId> for InferenceResult
Source§impl Index<Idx<Binding>> for InferenceResult
impl Index<Idx<Binding>> for InferenceResult
Source§impl Index<Idx<Expr>> for InferenceResult
impl Index<Idx<Expr>> for InferenceResult
Source§impl Index<Idx<Pat>> for InferenceResult
impl Index<Idx<Pat>> for InferenceResult
Source§impl PartialEq for InferenceResult
impl PartialEq for InferenceResult
impl Eq for InferenceResult
impl StructuralPartialEq for InferenceResult
Auto Trait Implementations§
impl Freeze for InferenceResult
impl !RefUnwindSafe for InferenceResult
impl Send for InferenceResult
impl Sync for InferenceResult
impl Unpin for InferenceResult
impl !UnwindSafe for InferenceResult
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
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