Skip to main content

resolve_field_origin_inner

Function resolve_field_origin_inner 

Source
fn resolve_field_origin_inner<'tcx>(
    tcx: TyCtxt<'tcx>,
    root_ty: Ty<'tcx>,
    fields: &[usize],
) -> Option<FieldOrigin>
Expand description

If local (typically 1 = self) with fields in def_id’s body corresponds to a struct field, return its identity. Trace a multi-level field path (self.node.ptr, self.mid.leaf.ptr) down to the innermost raw-pointer field, so the encapsulation check targets Inner::ptr / Leaf::ptr rather than the intermediate Outer::node / Outer::mid field. Intermediate reference and ADT layers are dereferenced through; if the path ends without reaching a raw pointer, None is returned.