Open mkeeter opened 1 year ago
you'll have to disable both proc-macros and build scripts for it skip running build scripts ( one requires the other currently).
I am not sure how well we can tackle this, since we run things on the top level virtual workspace here, so we might not be able to honor exclude dir in terms of cargo commands
I've got a dummy workspace project with two crates in it:
foo
andbar
.foo
will panic in thebuild.rs
(for the purposes of showing this issue), so I've added it torust-analyzer.files.excludeDirs
.However, it's still throwing an error in my text editor:
In the LSP logs, I see that
rust-analyzer
has correctly deserialized theexcludeDirs
configuration:Despite this configuration, it then proceeds to try building
proc-macros
forfoo
:Detailed logs
``` [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 272325875 } handle_event(FetchWorkspace(Report("metadata"))) [INFO rust_analyzer::reload] did fetch workspaces [Ok(Cargo { root: Some("rust-analyzer-test"), n_packages: 2, sysroot: true, n_rustc_compiler_crates: 0, n_rustc_cfg: 76, n_cfg_overrides: 1, toolchain: Some(Version { major: 1, minor: 65, patch: 0 }), data_layout: Ok("e-m:o-i64:64-i128:128-n32:64-S128") })] [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 551157750 } handle_event(FetchWorkspace(End([Ok(Cargo { root: Some("rust-analyzer-test"), n_packages: 2, sysroot: true, n_rustc_compiler_crates: 0, n_rustc_cfg: 76, n_cfg_overrides: 1, toolchain: Some(Version { major: 1, minor: 65, patch: 0 }), data_layout: Ok("e-m:o-i64:64-i128:128-n32:64-S128") })]))) [INFO rust_analyzer::reload] will switch workspaces cause=fetched workspace [DEBUG rust_analyzer::reload] abandon build scripts for workspaces [INFO rust_analyzer::reload] Spawning proc-macro servers [INFO rust_analyzer::reload] Using proc-macro server at /Users/mjk/.rustup/toolchains/stable-aarch64-apple-darwin/libexec/rust-analyzer-proc-macro-srv args=[] [INFO rust_analyzer::reload] did switch workspaces [INFO rust_analyzer::reload] will fetch workspaces cause=workspace vfs file change: /Users/mjk/rust-analyzer-test/foo/build.rs [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 552229500 } handle_event(Progress { n_total: 3, n_done: 0, config_version: 1 }) [INFO rust_analyzer::main_loop] task queue len: 1 [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 552298791 } handle_event(FetchWorkspace(Begin)) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 552492750 } handle_event(Response(Response { id: RequestId(I32(3)), result: None, error: None })) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 552645333 } handle_event(Response(Response { id: RequestId(I32(4)), result: None, error: None })) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 554032375 } handle_event(Loaded { n_files: 1 }) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 554750583 } handle_event(Loaded { n_files: 2 }) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 579256625 } handle_event(Loaded { n_files: 1256 }) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 651314875 } handle_event(FetchWorkspace(Report("metadata"))) [INFO rust_analyzer::reload] did fetch workspaces [Ok(Cargo { root: Some("rust-analyzer-test"), n_packages: 2, sysroot: true, n_rustc_compiler_crates: 0, n_rustc_cfg: 76, n_cfg_overrides: 1, toolchain: Some(Version { major: 1, minor: 65, patch: 0 }), data_layout: Ok("e-m:o-i64:64-i128:128-n32:64-S128") })] [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 865308958 } handle_event(FetchWorkspace(End([Ok(Cargo { root: Some("rust-analyzer-test"), n_packages: 2, sysroot: true, n_rustc_compiler_crates: 0, n_rustc_cfg: 76, n_cfg_overrides: 1, toolchain: Some(Version { major: 1, minor: 65, patch: 0 }), data_layout: Ok("e-m:o-i64:64-i128:128-n32:64-S128") })]))) [INFO rust_analyzer::reload] will switch workspaces cause=fetched workspace [INFO rust_analyzer::reload] build scripts do not match the version of the active workspace [INFO rust_analyzer::reload] will fetch workspaces cause=workspace vfs file change: /Users/mjk/.rustup/toolchains/stable-aarch64-apple-darwin/lib/rustlib/src/rust/library/profiler_builtins/build.rs [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 865449875 } handle_event(FetchWorkspace(Begin)) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 865618541 } handle_event(Response(Response { id: RequestId(I32(5)), result: None, error: None })) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394562, tv_nsec: 965401916 } handle_event(FetchWorkspace(Report("metadata"))) [INFO rust_analyzer::reload] did fetch workspaces [Ok(Cargo { root: Some("rust-analyzer-test"), n_packages: 2, sysroot: true, n_rustc_compiler_crates: 0, n_rustc_cfg: 76, n_cfg_overrides: 1, toolchain: Some(Version { major: 1, minor: 65, patch: 0 }), data_layout: Ok("e-m:o-i64:64-i128:128-n32:64-S128") })] [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394563, tv_nsec: 186971625 } handle_event(FetchWorkspace(End([Ok(Cargo { root: Some("rust-analyzer-test"), n_packages: 2, sysroot: true, n_rustc_compiler_crates: 0, n_rustc_cfg: 76, n_cfg_overrides: 1, toolchain: Some(Version { major: 1, minor: 65, patch: 0 }), data_layout: Ok("e-m:o-i64:64-i128:128-n32:64-S128") })]))) [INFO rust_analyzer::reload] will switch workspaces cause=fetched workspace [INFO rust_analyzer::reload] build scripts do not match the version of the active workspace [INFO rust_analyzer::reload] will fetch build data cause=workspace updated [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394563, tv_nsec: 187122166 } handle_event(FetchBuildData(Begin)) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394563, tv_nsec: 187231333 } handle_event(Response(Response { id: RequestId(I32(6)), result: None, error: None })) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394563, tv_nsec: 371738666 } handle_event(FetchBuildData(Report("building proc-macros: foo"))) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394563, tv_nsec: 542921958 } handle_event(FetchBuildData(Report("building proc-macros: foo"))) [DEBUG rust_analyzer::main_loop] Instant { tv_sec: 394563, tv_nsec: 605121583 } handle_event(FetchBuildData(End(([Cargo { root: Some(\"rust-analyzer-test\"), n_packages: 2, sysroot: true, n_rustc_compiler_crates: 0, n_rustc_cfg: 76, n_cfg_overrides: 1, toolchain: Some(Version { major: 1, minor: 65, patch: 0 }), data_layout: Ok(\"e-m:o-i64:64-i128:128-n32:64-S128\") }], [Ok(WorkspaceBuildScripts { outputs: ArenaMap { v: [Some(BuildScriptOutput { cfgs: [], envs: [], out_dir: None, proc_macro_dylib_path: None }), Some(BuildScriptOutput { cfgs: [], envs: [], out_dir: None, proc_macro_dylib_path: None })], _ty: PhantomData(the full raw logs are here, but I reformatted them for ease of reading)
This is also the case if I set
procMacro.enable = false
, oddly enough – I see the same thing in the logs:then the same panic as before.
I'm running in Neovim with
rust-tools
, but could try to reproduce in VSCode if that would be helpful!rust-analyzer version:
rust-analyzer 0.0.0 (f1b257f4e 2023-01-27)
rustc version:
rustc 1.65.0 (897e37553 2022-11-02)
relevant settings: