about summary refs log tree commit diff
path: root/compiler/rustc_middle
diff options
context:
space:
mode:
authorTrevor Gross <t.gross35@gmail.com>2025-08-08 14:22:43 -0500
committerGitHub <noreply@github.com>2025-08-08 14:22:43 -0500
commitf5dda197758f7ae94538ef6c2beec21c44a18c7b (patch)
tree75de47433f26791576a27da4cf15a59178c19d02 /compiler/rustc_middle
parent6674fe282bc48ef94e56b44bab582b7630987d29 (diff)
parent99196657fcb5c1e20c13e76166c7f52d35584e88 (diff)
downloadrust-f5dda197758f7ae94538ef6c2beec21c44a18c7b.tar.gz
rust-f5dda197758f7ae94538ef6c2beec21c44a18c7b.zip
Rollup merge of #144039 - estebank:short-paths, r=fee1-dead
Use `tcx.short_string()` in more diagnostics

`TyCtxt::short_string` ensures that user visible type paths aren't overwhelming on the terminal output, and properly saves the long name to disk as a side-channel. We already use these throughout the compiler and have been using them as needed when users find cases where the output is verbose. This is a proactive search of some cases to use `short_string`.

We add support for shortening the path of "trait path only".

Every manual use of `short_string` is a bright marker that that error should be using structured diagnostics instead (as they have proper handling of long types without the maintainer having to think abou tthem).
Diffstat (limited to 'compiler/rustc_middle')
-rw-r--r--compiler/rustc_middle/src/ty/print/pretty.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/compiler/rustc_middle/src/ty/print/pretty.rs b/compiler/rustc_middle/src/ty/print/pretty.rs
index b381d62be47..67244e767cb 100644
--- a/compiler/rustc_middle/src/ty/print/pretty.rs
+++ b/compiler/rustc_middle/src/ty/print/pretty.rs
@@ -2987,7 +2987,7 @@ impl<'tcx> ty::Binder<'tcx, ty::TraitRef<'tcx>> {
     }
 }
 
-#[derive(Copy, Clone, TypeFoldable, TypeVisitable, Lift)]
+#[derive(Copy, Clone, TypeFoldable, TypeVisitable, Lift, Hash)]
 pub struct TraitPredPrintModifiersAndPath<'tcx>(ty::TraitPredicate<'tcx>);
 
 impl<'tcx> fmt::Debug for TraitPredPrintModifiersAndPath<'tcx> {