fix(rust): resolve use super::* callees in #[path] modules - #1892
Open
seonghobae wants to merge 1 commit into
Open
seonghobae wants to merge 1 commit into
seonghobae wants to merge 1 commit into
Conversation
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>
Author
|
Maintainer note: this PR is still blocked on required review ( |
This branch has not been deployed
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
#[path = "..."] mod name;inclusions to their declaring parent module file sosuperin an included file refers to the lexical parent, not a path derived from the included file's disk location (Rust Reference, Modules / Paths).usedeclarations (includinguse super::*globs) into import mappings and resolve bare callees through the imported module before global name-matching.scripts/repro-rust-path-callee.shreproducing CodeGraph: same-name callee over-approximation for scaling test module imports ContextualWisdomLab/fast-mlsirm#1837 (same-namepredict_rating_multiin two crates;#[path]test module withuse super::*must call the parentscaling.rssymbol, not the decoy inlib.rs).Test plan
npx vitest run __tests__/rust-path-super-glob.test.tsnpx vitest run __tests__/rust-self-owner.test.ts(no regression)./scripts/repro-rust-path-callee.shContext
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_multiinstead ofcrates/mlsirm-core/src/scaling.rs:predict_rating_multi.Made with Cursor