Skip to content

Macro scanner skips extern "Rust" fn despite AST rewriter allowing it #144

@rocketman-code

Description

@rocketman-code

Context

The AST-level `is_instrumentable()` in `resolve.rs` allows `extern "Rust" fn` (it checks the ABI string and only rejects non-Rust ABIs). The token-level macro scanner in `rewrite.rs` rejects all `extern` prefixes without checking the ABI string.

This means `extern "Rust" fn helper() { ... }` inside a `macro_rules!` template will be skipped by the macro scanner but would be instrumented by the AST-level rewriter for regular functions.

Current behavior

`skip_non_instrumentable_fn` and `match_fn_pattern` reject any function with an `extern` keyword regardless of ABI.

Desired behavior

The macro scanner should check if the ABI literal is `"Rust"` and allow instrumentation in that case, matching the AST rewriter behavior.

Scope

Very low priority. `extern "Rust" fn` inside `macro_rules!` is exceedingly rare. The current behavior is conservative (skip rather than wrong instrumentation), which is the safer default.

Discovered during code review of PR #143.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions