rust-lang / rust-lang/rust-analyzer
Don't expose Block modules from hir
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
hir::Module has source, which returnsModuleSource, which stores BlockExpr as a possible variant. treating block with items as module might be fine, but we definitely should not expose this complexity to an IDE. Not sure whats the best way to achieve that though.
One approach is to add a hir::ModuleSource which asserts that the module is real, and sped the rest of our lives tracking assertion failures.
Another approach is to somehow distinguish real and fake modules in the compiler level by either turning a module into an enum, or by introducing a separate ModuleScope.
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 by tracing hir::Module::source and the ModuleSource variant that stores BlockExpr. Compare the proposed real-module assertion with distinguishing real and fake modules at the compiler level, using a separate ModuleScope or enum as described. Done means IDE-facing HIR no longer exposes block modules or their implementation complexity, with assertion failures or affected paths addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers, developer-experience
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100