From e6a7fdedd720cce583f30cab41f67bf0a353a75a Mon Sep 17 00:00:00 2001 From: jyn Date: Wed, 17 May 2023 23:15:22 -0500 Subject: Give a more useful location for where a span_bug was delayed Before: ``` = note: delayed at 0: ::emit_diagnostic at ./compiler/rustc_errors/src/lib.rs:1335:29 1: ::emit_diagnostic at ./compiler/rustc_errors/src/lib.rs:1124:9 ... ``` After: ``` = note: delayed at compiler/rustc_parse/src/parser/diagnostics.rs:2158:28 0: ::emit_diagnostic at ./compiler/rustc_errors/src/lib.rs:1335:29 1: ::emit_diagnostic at ./compiler/rustc_errors/src/lib.rs:1124:9 ``` This both makes the relevant frame easier to find without having to dig through diagnostic internals, and avoids the weird-looking formatting for the first frame. --- compiler/rustc_errors/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'compiler/rustc_errors') diff --git a/compiler/rustc_errors/src/lib.rs b/compiler/rustc_errors/src/lib.rs index 0f360473619..d5855527242 100644 --- a/compiler/rustc_errors/src/lib.rs +++ b/compiler/rustc_errors/src/lib.rs @@ -1740,7 +1740,7 @@ impl DelayedDiagnostic { } fn decorate(mut self) -> Diagnostic { - self.inner.note(format!("delayed at {}", self.note)); + self.inner.note(format!("delayed at {}\n{}", self.inner.emitted_at, self.note)); self.inner } } -- cgit 1.4.1-3-g733a5