about summary refs log tree commit diff
path: root/compiler/rustc_errors/src/diagnostic.rs
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2025-02-18 20:45:27 +0000
committerEsteban Küber <esteban@kuber.com.ar>2025-02-25 16:56:04 +0000
commita4e89deb52eac24d857823f46a3f38b02178731a (patch)
treeede24a875bbbed51dab3c11d6473450792148291 /compiler/rustc_errors/src/diagnostic.rs
parent26f74ef586d2d8849e93e9a1a6c6e803a0d21065 (diff)
downloadrust-a4e89deb52eac24d857823f46a3f38b02178731a.tar.gz
rust-a4e89deb52eac24d857823f46a3f38b02178731a.zip
add doc comment detail
Diffstat (limited to 'compiler/rustc_errors/src/diagnostic.rs')
-rw-r--r--compiler/rustc_errors/src/diagnostic.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/compiler/rustc_errors/src/diagnostic.rs b/compiler/rustc_errors/src/diagnostic.rs
index 97daf891b0f..7fffeaddb86 100644
--- a/compiler/rustc_errors/src/diagnostic.rs
+++ b/compiler/rustc_errors/src/diagnostic.rs
@@ -148,6 +148,12 @@ 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` is 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<std::path::PathBuf>) -> DiagArgValue;
 }