Workspace has sysroot errors: missing a core library

Open
#4,222 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 3 days

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Quiet
Tech stack
rust

Research direction

Start with the bazel run @rules_rust//tools/rust_analyzer:setup -- vscode workflow and the generated rust-analyzer sysroot at the path shown in the report. Investigate why the sysroot appears to lack core and why rust-analyzer suggests rustup in a Bazel-only setup; done means the warning is either reliably reproduced and explained or no longer appears incorrectly.

Written by the indexing model from the issue text.

Description

needs-triage rust-analyzer

Description

I'm using

bazel run @rules_rust//tools/rust_analyzer:setup -- vscode

to populate the rust-analyzer shims. I'm driving them from Emacs, and today I noticed a new message I haven't seen before:

[eglot] Server reports (type=2): Workspace /Users/mg/src/monorepo has sysroot errors: sysroot at /private/var/tmp/_bazel_mg/89452110e8744fab7faf12b87814819e/external/rules_rust++rust+rust_analyzer_1.95.0_tools/lib/rustlib/src/library is missing a core library, try running rustup component add rust-src to possibly fix this [3 times]

Reproduction steps

I'm unfortunately not sure how to reproduce this. Despite the error, I am still able to jump to definition.

I restarted my Emacs, re-opened a Rust file in my checkout and I didn't get the error this time. I can jump around, even into stdlib, and still no error.

So I'm mostly recording it here in case others see it.

Impact

It seems this doesn't actually impact the functionality.

It is confusing, though, especially the message about running rustup which is not applicable to a Bazel-only workflow 😄

Bazel and rules_rust version

Bazel 9.1.1, rules_rust 0.73.0

Dominant language
Starlark
Stars
857
Forks
701
Avg merge
4d 7h
Merged PRs (30d)
46

Getting set up

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.

More from bazelbuild/rules_rust

All issues in bazelbuild/rules_rust

Similar issues

More Build System issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.