Unnamed repository; edit this file 'description' to name the repository.
Auto merge of #17943 - Veykril:diags, r=Veykril
fix: Improve proc-macro panic message and workspace loading failure diagnostic
bors 2024-08-22
parent a84c3d4 · parent ada65fe · commit 9b72445
-rw-r--r--Cargo.toml3
-rw-r--r--crates/hir-expand/src/lib.rs2
-rw-r--r--crates/rust-analyzer/src/reload.rs2
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()
);
}