rust-lang / rust-lang/rust-analyzer
Always fails on servo / does too much
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 16.9k
- Forks
- 2.2k
- Avg merge
- 1d 12h
- Merged PRs (30d)
- 72
Description
Platform: vscode, win10
I'm getting this error on servo:
[ERROR rust_analyzer::reload] failed to switch build data: rust-analyzer failed to run build scripts:
error: failed to run custom build command for `simpleservo_jniapi v0.0.1 (D:\projects\servo\servo\ports\libsimpleservo\jniapi)`
Caused by:
process didn't exit successfully: `d:\projects\servo\servo\target\debug\build\simpleservo_jniapi-33f3c5db101519e6\build-script-build` (exit code: 101)
--- stderr
thread 'main' panicked at 'Please set the ANDROID_NDK environment variable', ports\libsimpleservo\jniapi\build.rs:11:36
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/e249ce6b2345587d6e11052779c86adbad626dff\/library\std\src\panicking.rs:495
1: core::panicking::panic_fmt
at /rustc/e249ce6b2345587d6e11052779c86adbad626dff\/library\core\src\panicking.rs:106
2: core::panicking::panic_display<str>
at /rustc/e249ce6b2345587d6e11052779c86adbad626dff\/library\core\src\panicking.rs:62
3: core::option::expect_failed
at /rustc/e249ce6b2345587d6e11052779c86adbad626dff\/library\core\src\option.rs:1638
4: enum$<core::option::Option<std::ffi::os_str::OsString>, 1, 18446744073709551615, Some>::expect<std::ffi::os_str::OsString>
at /rustc/e249ce6b2345587d6e11052779c86adbad626dff\library\core\src\option.rs:709
5: build_script_build::main
at .\build.rs:11
6: core::ops::function::FnOnce::call_once<void (*)(),tuple$<> >
at /rustc/e249ce6b2345587d6e11052779c86adbad626dff\library\core\src\ops\function.rs:227
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: build failed
- in servo's root directory
- tried using
"rust-analyzer.cargo.runBuildScripts": false - building servo does work
- uncommenting
"ports/libsimpleservo/jniapi/"in the root Cargo.toml works, next error is:
failed to run custom build command for `openssl-sys v0.9.67`
[...]
note: vcpkg did not find openssl: Could not find Vcpkg tree: No vcpkg installation found. Set the VCPKG_ROOT environment variable or run 'vcpkg integrate install'
which happens in servo/components/net
Maybe it's more of a question why rust-analyzer seems to look through everything under the root dir?
If I switch to servo/components/allocator, which has it's own Cargo.toml, rust-analyzer will still try to index/run build scripts on the root servo dir.
I don't know how rust-analyzer works internally, but it seems to do a little "too much".
I'm mainly confused because building/running servo works, but this here doesn't
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the workspace root Cargo.toml, ports/libsimpleservo/jniapi/build.rs, and the components/allocator Cargo.toml mentioned in the report. Reproduce indexing from the allocator directory and inspect which workspace and build scripts rust-analyzer discovers; done means the behavior is corrected or clearly documented with a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, vscode
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100