rust-lang / rust-lang/rust-analyzer
"file not included in module tree" diagnostic for file included using include! macro
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: 1.77.2 (25ef9e3 2024-04-09)
rustc version: 1.77.2 (25ef9e3d8 2024-04-09)
editor or extension: neovim with nvim-lspconfig and rust-tools
code snippet to reproduce:
main.rs:
mod x { include!("x.rs"); }
fn main() {
x::x();
}
x.rs:
pub fn x() { }
Cargo.toml (as generated by cargo init):
[package]
name = "ma"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
This code compiles, so it seems it's valid rust, yet rust-analyzer generates a diagnostic for file x.rs: "file not included in module tree" which does not seem correct.
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
Reproduce the diagnostic using the provided main.rs, x.rs, and Cargo.toml example, starting by confirming that cargo accepts the include! macro. Trace rust-analyzer's handling of the included file and module-tree diagnostics; done means x.rs no longer reports "file not included in module tree" while the valid example remains supported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100