Rust liveness: module-path calls, Self:: helpers and function values count as uses

Merged
AF
14d ago
+333-20

aft_inspect dead_code and test-only verdicts, and aft_callgraph, missed two Rust use shapes (reported from the entorhinal repo, where seven used functions were listed as dead or test-only):

  • Module-path calls such as checks::check(), crate::/super::/self:: prefixes, use aliases, and Self:: helpers inside impls now resolve to their target, scoped from the enclosing (including inline) module. An unresolved qualifier no longer binds an unrelated import that shares the final name.
  • Function values (Self { draw: checks::draw }, let f = m::g;, array elements, arguments) count as references that keep the function live. aft_callgraph callers lists them as callback_ref, not calls, and they stay out of execution trees.

The call-graph build output version moves to v21, so each project rebuilds its call graph once after upgrade.

Tests: Rust fixtures for both shapes, each with a planted dead function so the check isn't vacuous; callers return the use sites with their kind; qualified paths through inline modules, aliases and super::super::super::. On the build server, 1,161 callgraph/inspect/materialization tests and the Windows target check passed. One unrelated health test failed under load and passed alone three times.


Summary by cubic

Fixes Rust dead-code and test-only false positives in aft_inspect and aft_callgraph for two missed use shapes: module-path calls (checks::check(), crate::/super::/self:: prefixes, use aliases, Self:: helpers) now resolve to their target from the enclosing inline module, and an unresolved qualifier no longer binds an unrelated import sharing the final name.

Function values (Self { draw: checks::draw }, let f = m::g;, array elements, arguments) now count as references that keep functions live; aft_callgraph callers lists them as callback_ref and they stay out of execution trees. The call-graph build output version moves to v21, so each project rebuilds its call graph once after upgrade.