Skip to main content

resolve_chain_contracts

Function resolve_chain_contracts 

Source
fn resolve_chain_contracts<'tcx>(
    tcx: TyCtxt<'tcx>,
    callee_def_id: DefId,
    visited: &mut HashSet<DefId>,
) -> FnContracts<'tcx>
Expand description

Follow an unsafe callee’s call chain to find inherited safety contracts.

When an unsafe callee (e.g. B) lacks its own contracts, look into its MIR body for the unsafe callees it calls (e.g. C, D). If one of those has contracts (e.g. D), inherit them. The chain A -> B -> C -> D means A’s checkpoint on B is verified using D’s contracts.

visited prevents infinite recursion on mutually-recursive functions.