Skip to main content

check_escaped_field

Function check_escaped_field 

Source
fn check_escaped_field(
    tcx: TyCtxt<'_>,
    caller: DefId,
    sfo: &FieldOrigin,
    kind: HazardKind,
) -> VmAliasResult
Expand description

Shared escape + field-encapsulation check: a view that escapes and traces to a struct field is safe only if the field is private and not written/exposed by safe code. A unique (&mut) view escaping through a private raw field is still unsound — the caller can re-enter and obtain a second &mut.