rust-lang / rust-lang/rust-analyzer

Submodule confusion

Open
#18,406 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-vfs C-bug
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

rust-analyzer version: (eg. output of "rust-analyzer: Show RA Version" command, accessible in VSCode via Ctrl/⌘+Shift+P)
v0.3.2154
rustc version: (eg. output of rustc -V)
rustc 1.82.0 (f6e511eec 2024-10-15)
editor or extension: (eg. VSCode, Vim, Emacs, etc. For VSCode users, specify your extension version; for users of other editors, provide the distribution if applicable)
VSCODE
relevant settings: (eg. client settings, or environment variables like CARGO, RUSTC, RUSTUP_HOME or CARGO_HOME)

repository link (if public, optional): (eg. rust-analyzer)

code snippet to reproduce:

  1. have code that relies on some submodule submod.rs
  2. refactor code and delete submod.rs and instead use submod/mod.rs
  3. rust-analyzer does not really recognize submod/mod.rs and instead uses the deleted submod.rs even after deleting /target and rebuilding
  4. f12 view source on a function imported from submod/mod.rs will open submod.rs instead if the function existed in submod.rs
  5. submod/mod.rs will not have any compiler hints on hover
  6. however, submod/other_mod.rs included by submod/mod.rs will have compiler hints
mod submod;

fn main() {
  submod::some_func();
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the module move from submod.rs to submod/mod.rs in VSCode using the provided Rust snippet. Start by checking rust-analyzer's handling of submod/mod.rs through F12 and hover, and compare it with submod/other_mod.rs. Done means the new module path is recognized, source navigation no longer opens the deleted file, and compiler hints appear in submod/mod.rs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.