From a33d786fe14959d8d36091c518b62c6932f95ce5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Esteban=20K=C3=BCber?= Date: Tue, 18 Feb 2025 20:45:27 +0000 Subject: [PATCH] add doc comment detail --- compiler/rustc_errors/src/diagnostic.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs index 97daf891b0fe1..95b9eac547905 100644 --- a/compiler/rustc_errors/src/diagnostic.rs +++ b/compiler/rustc_errors/src/diagnostic.rs @@ -148,6 +148,13 @@ where /// converted rather than on `DiagArgValue`, which enables types from other `rustc_*` crates to /// implement this. pub trait IntoDiagArg { + /// Convert `Self` into a `DiagArgValue` suitable for rendering in a diagnostic. + /// + /// It takes a `path` where "long values" could be written to, if the `DiagArgValue` would be + /// too big for displaying on the terminal. This path comes from the `Diag` itself. When + /// rendering values that come from `TyCtxt`, like `Ty<'_>`, they can use + /// `TyCtxt::short_string`. If a value has no shortening logic that could be used, the argument + /// can be safely ignored. fn into_diag_arg(self, path: &mut Option) -> DiagArgValue; }