Skip to main content

Module inline_trait_caller_scanner

Module inline_trait_caller_scanner 

Source
Expand description

CrossCrate InlineTrait Phase 2c — caller crate scanner.

Given a target trait SymbolId, walks the workspace’s typeflow graph for containers (functions / impl blocks / etc.) that reference the trait, filters down to cross-crate callers (i.e. containers living in a different crate from the trait), and classifies each caller via the classify_fn helper from ryo-mutations (Phase 2a+2b).

Each cross-crate caller produces a CallerRewrite entry listing the CallerPattern variants the executor must apply during the caller-side AST migration in Phase 2d:

  • Dot — post-inline dispatch is unchanged; no AST edit.
  • Ufcs — rewrite <S as Trait>::m(..)S::m(..).
  • GenericBound— strip T: Trait generic param and specialize.
  • DynDispatch — rewrite &dyn Trait&S.
  • Other — block inline (conservatively).

Phase 2c stops at the scan + classify boundary. The executor does not rewrite caller crates yet; that engine arrives in Phase 2d, consuming the CallerRewrite entries produced here.

Structs§

CallerRewrite
Per-caller rewrite metadata returned by scan_cross_crate_callers.

Enums§

CascadeVerdict
Result of walk_transitive_callers — whether the cascade from a pub GenericBound caller can be safely rewritten given the in- workspace call graph.

Functions§

scan_cross_crate_callers
Convenience wrapper that reads the ASTRegistry and SymbolRegistry off an AnalysisContext. Used by the integration pin and by any caller that already holds a full analysis context.
scan_cross_crate_callers_raw
Scan every cross-crate caller of trait_id and classify each by caller-side rewrite pattern.
scan_same_crate_external_callers
Convenience wrapper for scan_same_crate_external_callers_raw that takes an AnalysisContext.
scan_same_crate_external_callers_raw
Phase 5-B: symmetric counterpart to scan_cross_crate_callers_raw that returns the callers living in the same crate as the trait (excluding the implementor’s own impl block and any of its method children). Used by the suggester to detect the mixed-handling case where same-crate external use coexists with cross-crate callers — in that situation the Phase 3 gate must fall through to the v3.1 EXTERNAL_USE filter chain rather than bypassing it.
walk_transitive_callers
BFS over code_graph.callers_of starting at root_caller_id to decide whether the transitive caller cascade ever surfaces a pub API leaf with no in-workspace caller.