From 8f6a1e5ee51312e4f0258f4f5fd9c14a918e7899 Mon Sep 17 00:00:00 2001 From: Wilfred Hughes Date: Tue, 21 Jan 2025 11:06:05 -0800 Subject: [PATCH] internal: Treat cfg fetching failures as a warning If the user doesn't have rustc on $PATH, rust-analyzer won't be able to run `rustc --print cfg`. This isn't really an error, as rust-analyzer can still proceed without it. This is particularly noticeable when loading crates defined in a rust-project.json. Until the configuration is loaded, the opened files are briefly treated as detached files and users see this error. Environments with rust-project.json generally have a sysroot and rustc elsewhere, so the error confuses users. --- crates/project-model/src/toolchain_info/rustc_cfg.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/project-model/src/toolchain_info/rustc_cfg.rs b/crates/project-model/src/toolchain_info/rustc_cfg.rs index 4bf9b59e7d..e472da0c89 100644 --- a/crates/project-model/src/toolchain_info/rustc_cfg.rs +++ b/crates/project-model/src/toolchain_info/rustc_cfg.rs @@ -19,7 +19,7 @@ pub fn get( let rustc_cfgs = match rustc_cfgs { Ok(cfgs) => cfgs, Err(e) => { - tracing::error!(?e, "failed to get rustc cfgs"); + tracing::warn!(?e, "failed to get rustc cfgs"); return vec![]; } };