Repository navigation
calls_out (Rust): macros and turbofish calls are calls; match/let patterns are not - #3726
Merged
Merged
Conversation
…ns are not (#3643) rust gets CALLS_OUT_RUST (group 1 = callee, so qualifier capture and the C5 header check are unchanged): - a macro is a call to its name: `format!(`, `vec![`, `quote!{`; never `macro_rules! name {`; - a turbofish between name and `(`: `collect::<Vec<_>>()`, two nesting levels; - a capitalised `Name(...)` whose one-line argument list is followed by `=>`, a pattern `|` (also on the next line, as multi-line arms write it), a binding `=` or a match guard `if` is a pattern, not a call. `Fn`/`FnMut`/`FnOnce` join rust's keyword set: `F: Fn(&T)` is a type. call_graph_accuracy (rust): precision 89.8% -> 96.6%, recall 90.3% -> 99.9% (FP 734 -> 250, FN 697 -> 5). Most remaining FPs (220) are calls inside macro arguments, which tree-sitter cannot see into. No other language moved; golden masters unchanged (no newly seen callee resolves to a file edge). keyword-rosetta: rust moves (probe_test gains assert/assert_eq, probe_telemetry info/error), the macro gap its calls_out_truth.json lists as known. Needs a corpus re-bless after merge. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
…-3643 # Conflicts: # gitgalaxy/standards/language_standards/_shared_patterns.py
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #3643 (part of #3641). Rust used the shared
\b(name)\s*\(pattern, which has three problems:format!(,vec[).collect::<Vec<_>>()).Data::Struct(x) =>,Ok(t) =>,if let Some(x) =). C3's 2026-09-25 amendment says a pattern is not a call.Rust now has its own
CALLS_OUT_RUST. Group 1 is still the callee, so qualifier capture and the C5 nested-header check are unchanged.Macro:
name!(,name[orname!{is a call toname.macro_rules! foo {is not, because its!isn't followed by the delimiter.Turbofish:
name::<…>(, allowing two levels of nested generics, one line, with no parens, braces or quotes inside.Pattern: a capitalised
Name(…)(a variant or tuple struct) whose balanced one-line argument list is followed by any of:=>;|, which may also start the next line, since multi-line arms put it there;=, but never==, the=of=>, or||/|=;if. An expression never hasifafter a call, because Rust has no postfixif.Any closing
)/]of an enclosing pattern may come in between, as inErr(X::Gone(e)) =>. A lowercase guard call, likeif valid(x) =>, stays a call.Fn,FnMutandFnOncejoin Rust's keyword set.F: Fn(&T)andimpl FnOnce(u8)are types, not calls (C2).ReDoS: every quantifier is bounded, and the pattern check runs only where a capitalised word starts. The tests include 8 pathological payloads. The contract doc's C3 records all of this.
Cross-repo
keyword-rosetta needs a re-bless after this merges. Its Rust folder moves in two places:
a.rs → probe_testgainsassertandassert_eq;b.rs → probe_telemetrygainsinfoanderror.These are exactly the macro calls that the corpus's
docs/calls_out_truth.jsonlists underknown_gaps.macros("not captured by the paren paradigm"). So the move is the intended improvement, not a regression. This PR carriesrosetta:rebless-owed.Merge order: this PR first. Then a keyword-rosetta PR against engine
mainre-blesses the Rust manifest and removes themacrosknown gap fromcalls_out_truth.json. I'll open that PR once this one merges.Type of change
gitgalaxy/core/detector.py,language_standards.py,prism.py, or a per-language rule)CI checklist
python tests/tools/audit_check.pypasses (bundles the ruff/mypy/dead-key baseline-gated audits +ruff format --check)python -m pytest tests/passespython tests/tools/crucible_check.pypasses: no drift in either mode (see below)tree_sitter_accuracy_audit.py --all --ci: not run locally. It scores functions, classes and args, which this PR doesn't touch; CI runs it.Measurements
call_graph_accuracy.py(Level 1, against tree-sitter), on language-crucible v1.5.0, for Rust:No other language moved. The baseline is regenerated.
Of the 250 remaining false positives, 220 are calls inside macro arguments (
assert_eq!(x, Some(y)),vec[Some(&A(1))]). tree-sitter leaves a macro's argument tokens unparsed, but they are real calls under C1/C3, so the engine keeps them. The rest are smaller pattern shapes:lit: syn::Lit::Str(lit),);(Some(c), None) =>);Golden masters: no drift in either mode. Every callee this adds or drops (macros,
Some/Ok/Err, variants) is external or a variant, so none of them resolves to a confident cross-file call edge.Differential Scan target
language-crucible
rust/(bevy, serde, syn, tokio).Verification
New test file:
tests/extraction/languages/test_calls_out_rust_3643.py. It covers:|arms and guards;splice()case;🤖 Generated with Claude Code
https://claude.ai/code/session_01GCpfMCUMpco98QGbsuv2sr
Generated by Claude Code