Skip to main content

try_field_load_effect

Function try_field_load_effect 

Source
pub(crate) fn try_field_load_effect(
    tcx: TyCtxt<'_>,
    callee: DefId,
) -> Option<CallEffect>
Expand description

Detect a field-getter callee from its MIR: a function whose body is (essentially) (*self).field — a single Deref + Field load returned as the function’s result. Produces a ReturnFieldOfArg effect so the materialized field is returned, without any name- or length-specific knowledge.

The match is conservative: the body must contain only the field load (plus a unit-return and storage markers).