Skip to content

fix(rust): resolve use super::* callees in #[path] modules - #1892

Open
seonghobae wants to merge 1 commit into
colbymchenry:mainfrom
seonghobae:fix/rust-path-super-glob-resolution
Open

seonghobae wants to merge 1 commit into
colbymchenry:mainfrom
seonghobae:fix/rust-path-super-glob-resolution

Conversation

@seonghobae

Copy link
Copy Markdown

Summary

  • Map #[path = "..."] mod name; inclusions to their declaring parent module file so super in an included file refers to the lexical parent, not a path derived from the included file's disk location (Rust Reference, Modules / Paths).
  • Extract Rust use declarations (including use super::* globs) into import mappings and resolve bare callees through the imported module before global name-matching.
  • Add regression test and scripts/repro-rust-path-callee.sh reproducing CodeGraph: same-name callee over-approximation for scaling test module imports ContextualWisdomLab/fast-mlsirm#1837 (same-name predict_rating_multi in two crates; #[path] test module with use super::* must call the parent scaling.rs symbol, not the decoy in lib.rs).

Test plan

  • npx vitest run __tests__/rust-path-super-glob.test.ts
  • npx vitest run __tests__/rust-self-owner.test.ts (no regression)
  • ./scripts/repro-rust-path-callee.sh

Context

Fixes false callee edge reported in ContextualWisdomLab/fast-mlsirm#1837 where CodeGraph 1.2.0 linked pr_elom_rowmean → crates/fast-mlsirm-py/src/lib.rs:predict_rating_multi instead of crates/mlsirm-core/src/scaling.rs:predict_rating_multi.

Made with Cursor

Map #[path] module inclusions to their declaring parent so bare names
imported via `use super::*` resolve through the lexical parent module
instead of global same-name matching across workspace crates.

Co-authored-by: Cursor <cursoragent@cursor.com>
@seonghobae

Copy link
Copy Markdown
Author

Maintainer note: this PR is still blocked on required review (REVIEW_REQUIRED) with no CI check-runs yet on head ff944a41. Local verification previously green per PR test plan (vitest + scripts/repro-rust-path-callee.sh). Happy to rebase or address any review feedback promptly.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant