rust-lang / rust-lang/rust-analyzer
Our module path exploration does not match rustc's
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Given a lib.rs or main.rs with:
mod outline;
With outline.rs defined as:
const _: () = {
mod inline {
#[path = "pathed.rs"]
mod pathed;
}
};
rustc attempts to load: src/inline/pathed.rs
r-a attempts to load: src/inline/pathed.rs
But with outline.rs defined as:
mod inline {
const _: () = {
mod inline {
#[path = "pathed.rs"]
mod pathed;
}
};
}
rustc attempts to load: src/outline/inline/inline/pathed.rs
r-a attempts to load: src/inline/inline/pathed.rs
This is apparently expected behaviour (I'd like to say it is not), though I don't quite fully grasp why: https://rust-lang.zulipchat.com/#narrow/stream/122651-general/topic/Surprising.20behaviour.20with.20.23.5Bpath.5D.20and.20block.20scopes
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the linked Zulip discussion, then reproduce the two module layouts using lib.rs or main.rs and outline.rs. Compare rustc's and rust-analyzer's attempted paths; done means rust-analyzer resolves the nested #[path] module to the same path as rustc.
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