rust-lang / rust-lang/rust-analyzer

Compile-time errors are only visible in the first project of a VSCode workspace

Open
#15,742 1 comment 0 reactions 0 assignees View on GitHub

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

Compile-time errors are only visible in the first project of a VSCode workspace.

Steps for reproducing the issue:

  1. Create Rust projects and a VSCode workspace for them:
    mkdir test
    cd test
    cargo new --lib lib1
    echo compile-time error here >> lib1/src/lib.rs
    cargo new --lib lib2
    echo compile-time error here >> lib2/src/lib.rs
    cargo new --lib lib3
    echo compile-time error here >> lib3/src/lib.rs
    cat > test.code-workspace <<END
    {
      "folders": [
        { "path": "lib1" },
        { "path": "lib2" },
        { "path": "lib3" }
      ],
      "settings": { "rust-analyzer.linkedProjects": [ "./Cargo.toml" ] }
    }
    END
    
  2. Open test.code-workspace in VSCode (with rust-analyzer extension installed).
  3. Open lib1/src/lib.rs, lib2/src/lib.rs and lib3/src/lib.rs by double-clicking them in VSCode explorer.
  4. Compile-time error is shown only for lib1/src/lib.rs, not for lib2/src/lib.rs or lib3/src/lib.rs.

Environment

  • macOS Ventura 13.6 @ Apple Silicon M2
  • VSCodium 1.83.0, release 23277
  • rust-analyzer extension 0.3.1689
  • rust-analyzer 1.73.0 (cc66ad46 2023-10-03)

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

Reproduce the issue with the provided test.code-workspace and the three lib.rs files, checking diagnostics in each project. Start by examining how rust-analyzer handles the linkedProjects workspace setting; done means compile-time errors appear for lib1, lib2, and lib3.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust, vscode
Domain
devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.