Skip to content

Rust: a call through a module that use super::* brings in has no edge on main (works in 1.6.2) #3253

Open

Description

@Egrn

Environment

codegraph 1.6.2 from npm, and current main (f72c9d2) built from source and run on Node 22.23.4. Linux, rustc 1.99.1, fresh codegraph init. The repro crate passes cargo check.

Problem

In a mod tests with use super::*, a call like gzip::write() (the parent declares pub mod gzip;) gets a call edge in 1.6.2, but not on current main. The same module path called from the parent itself still works. Maybe it came with #3014 (use bindings follow Rust's scopes).

Minimal repro

Cargo.toml:

[package]
name = "repro_superglob"
version = "0.1.0"
edition = "2021"

src/lib.rs:

pub mod store;

src/store/mod.rs:

pub mod gzip;

pub fn load() -> u8 {
    gzip::read()
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn writes() {
        gzip::write();
        let _ = load();
    }
}

src/store/gzip.rs:

pub fn read() -> u8 {
    1
}

pub fn write() {}

Actual

1.6.2:

load   -> read    resolvedBy import,      confidence 0.9, refName gzip::read    (ok)
writes -> load    resolvedBy exact-match, confidence 0.9, refName load          (ok)
writes -> write   resolvedBy import,      confidence 0.9, refName gzip::write   (ok)

Current main:

load   -> read   resolvedBy import,      confidence 0.9, refName gzip::read   (ok)
writes -> load   resolvedBy exact-match, confidence 0.9, refName load         (ok, the test fn is indexed)

writes -> write is gone, while writes -> load stays.

Expected

writes -> gzip::write on main too, as in 1.6.2. rust-analyzer resolves it to src/store/gzip.rs.

Notes

In our crate (42 files) this is the only call through a glob-imported module, and it is a test (gzip::write_single(…) in src/load/mod.rs). Related, I checked before posting: #3014 (merged), #1892 (closed, use super::* in #[path] modules).

Activity

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions