@@ -248,15 +248,27 @@ impl<'tcx> TyCtxt<'tcx> {
248
248
short
249
249
}
250
250
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
+
251
258
/// When calling this after a `Diag` is constructed, the preferred way of doing so is
252
259
/// `tcx.short_string(ty, diag.long_ty_path())`. The diagnostic itself is the one that keeps
253
260
/// the existence of a "long type" anywhere in the diagnostic, so the note telling the user
254
261
/// 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
256
268
where
257
269
T : Copy + Hash + for < ' a , ' b > Lift < TyCtxt < ' b > , Lifted : Print < ' b , FmtPrinter < ' a , ' b > > > ,
258
270
{
259
- let regular = FmtPrinter :: print_string ( self , hir :: def :: Namespace :: TypeNS , |cx| {
271
+ let regular = FmtPrinter :: print_string ( self , namespace , |cx| {
260
272
self . lift ( p) . expect ( "could not lift for printing" ) . print ( cx)
261
273
} )
262
274
. expect ( "could not write to `String`" ) ;
0 commit comments