Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rust-analyzer failed to run check or clippy command on rustc_private enabled files #20712

Open
1 task done
timurguvenkaya opened this issue Nov 15, 2024 · 5 comments
Open
1 task done
Labels
bug [core label] language server failure Language server doesn't work as expected reproducible Verified steps to reproduce included rust Rust programming language support

Comments

@timurguvenkaya
Copy link

Check for existing issues

  • Completed

Describe the bug / provide steps to reproduce it

Context:

  • I have a multi-crate repo with some crates utilising rustc_private.
  • Crates that utilize rustc_private are using different rust toolchain

with rustc_private

[toolchain]
channel = "nightly-2024-09-05"
components = [
    "cargo",
    "llvm-tools-preview",
    "rust-src",
    "rust-std",
    "rustc",
    "rustc-dev",
    "rustfmt",
]

regular crates

[toolchain]
channel = "stable"
components = ["rustfmt"]
targets = ["wasm32-unknown-unknown"]
  • I configured .zed to use rustc.source=discover and put it in the root of the repo.

.zed

{
"lsp": {
    "rust-analyzer": {
      "initialization_options": {
        "rustc": {
          "source": "discover"
        }
      }
    }
  }
}

Issue:

Rust analyzer cannot run check/clippy command on files with rustc_private. Even if I have an error/warning, it is not displayed

Tried with VSCode with .vscode (same settings) -> works with no problem

VSCode shows a warning of unused import:
Screenshot 2024-11-15 at 11 11 11

Zed does not show any warning:
Screenshot 2024-11-15 at 11 12 40

However, when I move .zed to the crate folder and open the crate directly with zed (not the project root) -> everything works.

Environment

Zed: v0.161.2 (Zed)
OS: macOS 15.0.1
Memory: 64 GiB
Architecture: aarch64

If applicable, add mockups / screenshots to help explain present your vision of the feature

No response

If applicable, attach your Zed.log file to this issue.

Zed.log 2024-11-15T10:45:08.584502+03:00 [INFO] found rust-analyzer in PATH. trying to run `rust-analyzer --help` 2024-11-15T10:45:08.63388+03:00 [INFO] found user-installed language server for rust-analyzer. path: "/Users/username/.cargo/bin/rust-analyzer", arguments: [] 2024-11-15T10:45:08.63406+03:00 [INFO] starting language server process. binary path: "/Users/username/.cargo/bin/rust-analyzer", working directory: "/Users/username/dev/some_project", args: [] 2024-11-15T10:45:13.741415+03:00 [WARN] skipping diagnostics update, no worktree found for path "/Users/username/.cargo/registry/src/some_crate/src/lib.rs" 2024-11-15T10:45:12.840731+03:00 [WARN] Generic lsp request to rust-analyzer failed: content modified 2024-11-15T10:45:12.840861+03:00 [ERROR] inlay hint update task for range failed: Error { context: "inlay hint fetch task", source: Error { context: "inlay hints LSP request", source: "content modified", }, } 2024-11-15T10:45:13.741415+03:00 [WARN] skipping diagnostics update, no worktree found for path "/Users/username/.cargo/registry/src/some_crate/src/lib.rs"
Language Server Log stderr: 2024-11-14T17:41:46.076389Z ERROR cyclic deps: some_crate(Idx::(0)) -> some_crate(Idx::(0)), alternative path: some_crate(Idx::(0))
@notpeter
Copy link
Member

Can you provide an example repo which demonstrates this issue so I can see if we can reproduce?

@notpeter notpeter added awaiting info Issue that needs more information from the user rust Rust programming language support language server failure Language server doesn't work as expected and removed triage labels Nov 26, 2024
@timurguvenkaya
Copy link
Author

timurguvenkaya commented Nov 30, 2024

@notpeter Attached POC with .zed and .vscode.

zed-poc.zip

@timurguvenkaya
Copy link
Author

@notpeter Lmk if you need any additional details

@timurguvenkaya
Copy link
Author

@notpeter Let me know if provided POC is sufficient

@devzeth
Copy link
Member

devzeth commented Feb 21, 2025

@notpeter @osiewicz reproduced in zed prev 175.1, might be the same as but ofc for rust : #4574

@devzeth devzeth added reproducible Verified steps to reproduce included and removed awaiting info Issue that needs more information from the user labels Feb 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [core label] language server failure Language server doesn't work as expected reproducible Verified steps to reproduce included rust Rust programming language support
Projects
None yet
Development

No branches or pull requests

3 participants