Auto merge of #14556 - Veykril:sysroot-no-core-warn, r=Veykril

internal: Warn when loading sysroot fails to find the core library

Should help a bit more with user experience, before we only logged this now we show it in the status
Closes https://github.com/rust-lang/rust-analyzer/issues/11606
This commit is contained in:
bors 2023-04-13 06:41:06 +00:00
commit b093423d12
2 changed files with 32 additions and 18 deletions

View file

@ -138,10 +138,20 @@ impl GlobalState {
let (ProjectWorkspace::Cargo { sysroot, .. }
| ProjectWorkspace::Json { sysroot, .. }
| ProjectWorkspace::DetachedFiles { sysroot, .. }) = ws;
if let Err(Some(e)) = sysroot {
status.health = lsp_ext::Health::Warning;
message.push_str(e);
message.push_str("\n\n");
match sysroot {
Err(None) => (),
Err(Some(e)) => {
status.health = lsp_ext::Health::Warning;
message.push_str(e);
message.push_str("\n\n");
}
Ok(s) => {
if let Some(e) = s.loading_warning() {
status.health = lsp_ext::Health::Warning;
message.push_str(&e);
message.push_str("\n\n");
}
}
}
if let ProjectWorkspace::Cargo { rustc: Err(Some(e)), .. } = ws {
status.health = lsp_ext::Health::Warning;