rust-lang / rust-lang/rust-analyzer

Opening stand-alone .rs files give "failed to discover workspace" error

Open
#13,654 1 comment 7 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-support
Dominant language
Rust
Stars
16.9k
Forks
2.2k
Avg merge
1d 12h
Merged PRs (30d)
72

Description

When opening stand-alone .rs files that are not contained in a Cargo project, rust-analyzer stops and gives the error "rust-analyzer failed to discover workspace". This is kind of annoying when the file is not intended to be in any Cargo workspace, but intended to be compiled directly with rustc.

There are some previous issues (#9082, #9089) that apparently fixed this, but I'm getting the error still today so I suppose there could have been a regression since then.

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 by reproducing the error when opening a stand-alone .rs file outside a Cargo workspace, then review the related issues #9082 and #9089 for the earlier behavior and expected handling. Done means stand-alone files no longer fail workspace discovery when they are intended to be compiled directly with rustc.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
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.