Skip to main content

check_fn_against_field

Function check_fn_against_field 

Source
fn check_fn_against_field(
    tcx: TyCtxt<'_>,
    item: DefId,
    origin: &FieldOrigin,
    current_self: Option<Mutability>,
    self_local: Local,
) -> Option<String>
Expand description

Check whether item (a struct method or a same-module free function) writes or exposes the raw field origin through the borrow carried by self_local. A shared current borrow (&self) is not invalidated by a mutable item borrow (&mut self), and a mutable/mutable pair is likewise fine; any other combination is a violation. Returns the violation description, or None.