rust-lang / rust-lang/rust-analyzer
if a package becomes a lib+bin package mid-edit, ra requires a restart to notice
Open
Nobody has claimed this yet.
C-bug
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
rust-analyzer version: rust-analyzer 1.86.0 (05f9846 2025-03-31)
rustc version: rustc 1.86.0 (05f9846f8 2025-03-31)
editor or extension: emacs eglot
relevant settings: eglot-ensure in rust-mode-hook
reproduction steps
cargo init --lib- open the newly created
src/lib.rsin editor - open (nonexistent)
src/main.rsin editor, addfn main() {}, save file - you will still be getting an
unlined-fileerror and all LSP features will not work except highlighting error/warning lines
workaround: restart rust-analyzer (in emacs this can be done with M-x eglot)
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 issue with cargo init --lib, then create and save src/main.rs while src/lib.rs is open. Start by tracing how rust-analyzer discovers package targets after workspace changes; done means the new binary target is recognized without restarting and LSP features work in src/main.rs.
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
- Mostly clear
- Newbie friendliness
- 45/100