@@ -423,7 +423,18 @@ impl Printer for SymbolPath {
423
423
self : PrintCx < ' _ , ' _ , ' tcx , Self > ,
424
424
ty : Ty < ' tcx > ,
425
425
) -> Result < Self :: Type , Self :: Error > {
426
- self . pretty_print_type ( ty)
426
+ match ty. sty {
427
+ // Print all nominal types as paths (unlike `pretty_print_type`).
428
+ ty:: FnDef ( def_id, substs) |
429
+ ty:: Opaque ( def_id, substs) |
430
+ ty:: Projection ( ty:: ProjectionTy { item_def_id : def_id, substs } ) |
431
+ ty:: UnnormalizedProjection ( ty:: ProjectionTy { item_def_id : def_id, substs } ) |
432
+ ty:: Closure ( def_id, ty:: ClosureSubsts { substs } ) |
433
+ ty:: Generator ( def_id, ty:: GeneratorSubsts { substs } , _) => {
434
+ self . print_def_path ( def_id, Some ( substs) , iter:: empty ( ) )
435
+ }
436
+ _ => self . pretty_print_type ( ty) ,
437
+ }
427
438
}
428
439
429
440
fn path_crate (
@@ -438,7 +449,22 @@ impl Printer for SymbolPath {
438
449
self_ty : Ty < ' tcx > ,
439
450
trait_ref : Option < ty:: TraitRef < ' tcx > > ,
440
451
) -> Result < Self :: Path , Self :: Error > {
441
- self . pretty_path_qualified ( self_ty, trait_ref)
452
+ // Similar to `pretty_path_qualified`, but for the other
453
+ // types that are printed as paths (see `print_type` above).
454
+ match self_ty. sty {
455
+ ty:: FnDef ( ..) |
456
+ ty:: Opaque ( ..) |
457
+ ty:: Projection ( _) |
458
+ ty:: UnnormalizedProjection ( _) |
459
+ ty:: Closure ( ..) |
460
+ ty:: Generator ( ..)
461
+ if trait_ref. is_none ( ) =>
462
+ {
463
+ self . print_type ( self_ty)
464
+ }
465
+
466
+ _ => self . pretty_path_qualified ( self_ty, trait_ref)
467
+ }
442
468
}
443
469
444
470
fn path_append_impl < ' gcx , ' tcx > (
0 commit comments