Skip to content

Commit a33d786

Browse files
committed
add doc comment detail
1 parent ce259e2 commit a33d786

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

compiler/rustc_errors/src/diagnostic.rs

+7
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ where
148148
/// converted rather than on `DiagArgValue`, which enables types from other `rustc_*` crates to
149149
/// implement this.
150150
pub trait IntoDiagArg {
151+
/// Convert `Self` into a `DiagArgValue` suitable for rendering in a diagnostic.
152+
///
153+
/// It takes a `path` where "long values" could be written to, if the `DiagArgValue` would be
154+
/// too big for displaying on the terminal. This path comes from the `Diag` itself. When
155+
/// rendering values that come from `TyCtxt`, like `Ty<'_>`, they can use
156+
/// `TyCtxt::short_string`. If a value has no shortening logic that could be used, the argument
157+
/// can be safely ignored.
151158
fn into_diag_arg(self, path: &mut Option<std::path::PathBuf>) -> DiagArgValue;
152159
}
153160

0 commit comments

Comments
 (0)