Skip to content

Commit c5ccf86

Browse files
committed
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.
1 parent a238ab8 commit c5ccf86

File tree

1 file changed

+1
-1
lines changed
  • src/tools/rust-analyzer/crates/project-model/src/toolchain_info

1 file changed

+1
-1
lines changed

src/tools/rust-analyzer/crates/project-model/src/toolchain_info/rustc_cfg.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ pub fn get(
1919
let rustc_cfgs = match rustc_cfgs {
2020
Ok(cfgs) => cfgs,
2121
Err(e) => {
22-
tracing::error!(?e, "failed to get rustc cfgs");
22+
tracing::warn!(?e, "failed to get rustc cfgs");
2323
return vec![];
2424
}
2525
};

0 commit comments

Comments
 (0)