Skip to content

fix(code-intel): calls inside Rust macro bodies (json!, vec!, format!, matches!, assert!) are not indexed; dead-code reports live functions #715

Closed

Description

@ajianaz

Cora version

0.20.0

Which command?

cora dead-code, cora callers.

What happened?

Function calls that appear inside a macro invocation are not seen as calls. In tole (8c05cd1):

  • tool_kind (crates/tole-cli/src/acp.rs:396) is reported by cora dead-code as "no callers found", but it is called at acp.rs:452 and acp.rs:618 inside json!({ "kind": tool_kind(tool), ... }).
  • approval_config_option (acp.rs:179) is reported the same way, but it is called at acp.rs:204 inside vec[approval_config_option(auto_write)].

Both of the two non-test hits I checked were false positives of this kind.

What did you expect to happen?

Tokens inside a macro invocation's delimiters are parsed as expressions where that is feasible (at least for the std macros json! from serde_json, vec!, format!, println!, assert!, assert_eq!, matches!, write!) and a call found there becomes a normal call edge. For user macros, scan the token tree for ident( and path::ident( patterns and mark those edges from-macro (lower confidence), still counted for dead-code.

Steps to reproduce

git clone https://github.com/codecoradev/tole && cd tole && git checkout 8c05cd1
cora index
cora dead-code | grep -E "tool_kind|approval_config_option"
grep -n "tool_kind(" crates/tole-cli/src/acp.rs

Logs / output

tool_kind crates/tole-cli/src/acp.rs:396 — function (no callers found)
approval_config_option crates/tole-cli/src/acp.rs:179 — function (no callers found)

Config (if relevant)

Default. Tracking issue: codecoradev/tole#669.

Before submitting

  • I searched existing issues and didn't find a duplicate

Activity

  1. added
    bug
    scope:code-intel
    epic:code-intelligence
    on Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugepic:code-intelligencepriority:highscope:code-intel

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions