bazelbuild / bazelbuild/rules_rust

Workspace has sysroot errors: missing a core library

Open
#4,222 0 comments 0 reactions 0 assignees View on GitHub
needs-triage rust-analyzer
Dominant language
Starlark
Stars
843
Forks
651
Avg merge
2d 18h
Merged PRs (30d)
15

Description

**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

Contributor guide

Open the contributing guide

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.