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: StringThe root local/global’s bare display name (p in p.x = expr).
root_ty: TyThe 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: AssignOpThe 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: TyThe RHS’s statically inferred type.
Trait Implementations§
Source§impl Clone for FieldAssignMismatch
impl Clone for FieldAssignMismatch
Source§fn clone(&self) -> FieldAssignMismatch
fn clone(&self) -> FieldAssignMismatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FieldAssignMismatch
impl Debug for FieldAssignMismatch
impl Eq for FieldAssignMismatch
Source§impl PartialEq for FieldAssignMismatch
impl PartialEq for FieldAssignMismatch
impl StructuralPartialEq for FieldAssignMismatch
Auto Trait Implementations§
impl Freeze for FieldAssignMismatch
impl RefUnwindSafe for FieldAssignMismatch
impl Send for FieldAssignMismatch
impl Sync for FieldAssignMismatch
impl Unpin for FieldAssignMismatch
impl UnsafeUnpin for FieldAssignMismatch
impl UnwindSafe for FieldAssignMismatch
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.