rust-lang / rust-lang/rust-analyzer

`#[path = "../XXXXXX"]` attribute on modules gives false `unresolved-module` error

Open
#9,173 18 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

image

image

Example: https://github.com/WilliamVenner/rust-analyzer-broken-example

Code:

./package/src/main.rs
#[path = "../../silly_mod/mod.rs"]
mod silly_mod;

fn main() {
    silly_mod::hello();
}
./silly_mod/mod.rs
pub fn hello() {
	println!("Hello, world!");
}

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

Start with the linked rust-analyzer-broken-example and the module layout shown in package/src/main.rs and silly_mod/mod.rs; reproduce the false unresolved-module diagnostic for the #[path] attribute. Trace the module-path resolution that handles this example, and consider the issue done when the valid module no longer produces that diagnostic.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.