From ada65feaa16456a4208aa50da30ebd55a002f00c Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Thu, 22 Aug 2024 18:46:23 +0200 Subject: [PATCH] Improve proc-macro panic message and workspace loading failure diagnostic --- Cargo.toml | 3 ++- crates/hir-expand/src/lib.rs | 2 +- crates/rust-analyzer/src/reload.rs | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index d8f9b2b7f6..aa7bd2dc5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,9 +19,10 @@ rowan.opt-level = 3 rustc-hash.opt-level = 3 smol_str.opt-level = 3 text-size.opt-level = 3 +serde.opt-level = 3 +salsa.opt-level = 3 # This speeds up `cargo xtask dist`. miniz_oxide.opt-level = 3 -salsa.opt-level = 3 [profile.release] incremental = true diff --git a/crates/hir-expand/src/lib.rs b/crates/hir-expand/src/lib.rs index 741c2b2ebf..19c3c9c43f 100644 --- a/crates/hir-expand/src/lib.rs +++ b/crates/hir-expand/src/lib.rs @@ -192,7 +192,7 @@ impl ExpandErrorKind { ("overflow expanding the original macro".to_owned(), true) } ExpandErrorKind::Other(e) => ((**e).to_owned(), true), - ExpandErrorKind::ProcMacroPanic(e) => ((**e).to_owned(), true), + ExpandErrorKind::ProcMacroPanic(e) => (format!("proc-macro panicked: {e}"), true), } } } diff --git a/crates/rust-analyzer/src/reload.rs b/crates/rust-analyzer/src/reload.rs index 4a2a400f44..5d0c6b6599 100644 --- a/crates/rust-analyzer/src/reload.rs +++ b/crates/rust-analyzer/src/reload.rs @@ -188,7 +188,7 @@ impl GlobalState { status.health |= lsp_ext::Health::Warning; format_to!( message, - "Workspace `{}` has been queried without dependencies, connecting to crates.io might have failed.\n\n", + "Failed to read Cargo metadata for `{}`, the `Cargo.toml` might be invalid or you have no internet connection.\n\n", ws.manifest_or_root() ); }