about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-11 16:30:59 +0000
committerbors <bors@rust-lang.org>2022-09-11 16:30:59 +0000
commit0d56e340472882fa673d4b98d0802b9a799879d0 (patch)
tree08fde05896e69a50926274fbd1854d6c04858679
parent17a627fe876ded260d5563751d8d1530275e1c55 (diff)
parent156717d3e5d3010cc78cdd1b401f70c264016b41 (diff)
downloadrust-0d56e340472882fa673d4b98d0802b9a799879d0.tar.gz
rust-0d56e340472882fa673d4b98d0802b9a799879d0.zip
Auto merge of #101678 - jannic:fix-101640, r=jyn514
Add diagnostic arg 'current_crate'

With this fix, I get almost the same error message as on stable, again.

However, I expected to get the new error message `std is required by {$current_crate} because it does not declare #![no_std]`, but I didn't. Instead, I got a new line `help: consider building the standard library from source with cargo build -Zbuild-std`. So I obviously do not fully understand what is going on.

In any case, the bug itself seems to be fixed by this patch.

Closes #101640
-rw-r--r--compiler/rustc_metadata/src/errors.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/rustc_metadata/src/errors.rs b/compiler/rustc_metadata/src/errors.rs
index 8378d2b791d..1406ee914af 100644
--- a/compiler/rustc_metadata/src/errors.rs
+++ b/compiler/rustc_metadata/src/errors.rs
@@ -572,6 +572,7 @@ impl SessionDiagnostic<'_> for CannotFindCrate {
     ) -> rustc_errors::DiagnosticBuilder<'_, ErrorGuaranteed> {
         let mut diag = handler.struct_err(rustc_errors::fluent::metadata::cannot_find_crate);
         diag.set_arg("crate_name", self.crate_name);
+        diag.set_arg("current_crate", self.current_crate);
         diag.set_arg("add_info", self.add_info);
         diag.set_arg("locator_triple", self.locator_triple.triple());
         diag.code(error_code!(E0463));