@@ -248,15 +248,27 @@ impl<'tcx> TyCtxt<'tcx> {
248248 short
249249 }
250250
251+ pub fn short_string < T > ( self , p : T , path : & mut Option < PathBuf > ) -> String
252+ where
253+ T : Copy + Hash + for < ' a , ' b > Lift < TyCtxt < ' b > , Lifted : Print < ' b , FmtPrinter < ' a , ' b > > > ,
254+ {
255+ self . short_string_namespace ( p, path, hir:: def:: Namespace :: TypeNS )
256+ }
257+
251258 /// When calling this after a `Diag` is constructed, the preferred way of doing so is
252259 /// `tcx.short_string(ty, diag.long_ty_path())`. The diagnostic itself is the one that keeps
253260 /// the existence of a "long type" anywhere in the diagnostic, so the note telling the user
254261 /// where we wrote the file to is only printed once.
255- pub fn short_string < T > ( self , p : T , path : & mut Option < PathBuf > ) -> String
262+ pub fn short_string_namespace < T > (
263+ self ,
264+ p : T ,
265+ path : & mut Option < PathBuf > ,
266+ namespace : hir:: def:: Namespace ,
267+ ) -> String
256268 where
257269 T : Copy + Hash + for < ' a , ' b > Lift < TyCtxt < ' b > , Lifted : Print < ' b , FmtPrinter < ' a , ' b > > > ,
258270 {
259- let regular = FmtPrinter :: print_string ( self , hir :: def :: Namespace :: TypeNS , |cx| {
271+ let regular = FmtPrinter :: print_string ( self , namespace , |cx| {
260272 self . lift ( p) . expect ( "could not lift for printing" ) . print ( cx)
261273 } )
262274 . expect ( "could not write to `String`" ) ;
0 commit comments