rust-lang / rust-lang/rust

Is overrideCommand in settings.json outdated?

Open
#149,530 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug needs-triage T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Summary

I tried using r-a on rustc code via neovim. Neovim uses the vscode settings from .vscode/settings.json. I got the following error in neovim:

rust-analyzer health status is [error]:                                                                                                                                                                                                                                                                              
Failed to run build scripts of some packages.                                                                                                                                                                                                                                                                                 
                                                                                                                                                                                                                                                                                                                              
Please refer to the logs for more details on the errors.cargo check failed to start: Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(unix_wait_status(512))):                                                                                                                             
/usr/tce/packages/python/python/bin/python3: can't open file '/tmp/drehwald1/prog/rust/src/bootstrap/x.py': [Errno 2] No such file or directory                            
Command used
nvim src/bootstrap/src/core/build_steps/llvm.rs
Expected behaviour

goto-definition etc. work

Actual behaviour

It gave the error shown above

Bootstrap configuration (bootstrap.toml)
<config>
Operating system

linux

HEAD

f392ed53ca3884c96430f2a283ffffa836b204f5

Additional context
Build Log

<log>

I'm not an expert on bootstrap things, but I vaguely remembered that there was some reworking a while ago. Looking at the folder /tmp/drehwald1/prog/rust/src/bootstrap/ I noticed there isn't a x.py script, but a bootstrap.py, which seemed to do the same thing. So I guess x.py was somehow called with an (incorrect) absolute path? We have /tmp/drehwald1/prog/rust/src/bootstrap/bootstrap.py and we have /tmp/drehwald1/prog/rust/x.py, but we don't (anymore?) have /tmp/drehwald1/prog/rust/src/bootstrap/x.py.

Removing all overrideCommand in https://github.com/rust-lang/rust/blob/1d60f9e070c1039b263e0f035c0f03dfcc610d0f/src/etc/rust_analyzer_settings.json#L12 fixed the error. Completely possible that this is just a user mistake, but removing these two worked for me. I also removed their equivalent from my .config/nvim/init.lua:

    3     "rust-analyzer.check.overrideCommand": [
    4         "python3",   
    5         "x.py",
    6         "check",
    7         "--json-output"
    8     ],
[...]
   23     "rust-analyzer.cargo.buildScripts.overrideCommand": [
   24         "python3",
   25         "x.py",
   26         "check",
   27         "--json-output",
   28         "--compile-time-deps"
   29     ],

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 with src/etc/rust_analyzer_settings.json and compare its overrideCommand entries with the current bootstrap entry points, especially x.py and src/bootstrap/bootstrap.py. Reproduce the issue with the reported Neovim command and rust-analyzer logs; done means the repository settings no longer invoke a missing path and goto-definition and related checks work.

Written by the indexing model from the issue text.

Assessment

Tech stack
neovim, python, rust
Domain
build-system, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 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.