Skip to main content

FieldAssignMismatch

Struct FieldAssignMismatch 

Source
pub struct FieldAssignMismatch {
    pub root: String,
    pub root_ty: Ty,
    pub path: Vec<Name>,
    pub op: AssignOp,
    pub found: Ty,
}
Expand description

One statically-checkable type mismatch at a dotted struct-field assignment target (issue #1900, split from #1864/#1877 — PR #1899’s own check_declared_assign_target explicitly excludes a multi-segment target, since a dotted target’s declared type is its root’s shape, not the field’s).

Body inference resolves only the ROOT’s declared type here (ctx.globals for a VAR/CONST, or an annotated Param/Temp’s ascription — see body::InferPass::check_declared_field_assign_target’s doc) — it has no struct-shape table of its own (the firewall: a body never reads project-wide STRUCT declarations), so path is recorded unresolved. structs::check_assignments (strict-mode-only) walks path against structs::declared_shapes/ShapeInfo to resolve the specific field’s declared type and reports E063.

Fields§

§root: String

The root local/global’s bare display name (p in p.x = expr).

§root_ty: Ty

The root’s resolved declared type — Ty::Struct(name) in the classifiable case; anything else (Unknown, a scalar/collection) is never recorded as a fact at all (see the recording site’s own “Unknown never disagrees” guard).

§path: Vec<Name>

The field-access chain past the root, in source order (p.x[x], p.inner.x[inner, x]) — each segment’s own Name carries the range a per-field diagnostic should point at.

§op: AssignOp

The assignment’s operator (=, +=, …). Carried alongside found (issue #1900 review finding) so structs::check_field_assign_mismatch — the only place the field’s declared type is ever resolved — can apply the same += string-numeric display-concat carve-out Stmt::Assignment’s own arm applies for a bare target: this body- inference pass only knows the ROOT’s type when the fact is recorded, not the field’s, so the carve-out can’t be decided here.

§found: Ty

The RHS’s statically inferred type.

Trait Implementations§

Source§

impl Clone for FieldAssignMismatch

Source§

fn clone(&self) -> FieldAssignMismatch

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for FieldAssignMismatch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FieldAssignMismatch

Source§

impl PartialEq for FieldAssignMismatch

Source§

fn eq(&self, other: &FieldAssignMismatch) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FieldAssignMismatch

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more