@@ -459,37 +459,52 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
459
459
type Path = Vec < String > ;
460
460
461
461
fn path_crate (
462
- self : & mut PrintCx < ' _ , ' _ , ' _ , Self > ,
462
+ self : PrintCx < ' _ , ' _ , ' _ , Self > ,
463
463
cnum : CrateNum ,
464
464
) -> Result < Self :: Path , Self :: Error > {
465
465
Ok ( vec ! [ self . tcx. original_crate_name( cnum) . to_string( ) ] )
466
466
}
467
467
fn path_qualified < ' tcx > (
468
- self : & mut PrintCx < ' _ , ' _ , ' tcx , Self > ,
469
- _impl_prefix : Option < Self :: Path > ,
468
+ self : PrintCx < ' _ , ' _ , ' tcx , Self > ,
470
469
_self_ty : Ty < ' tcx > ,
471
470
_trait_ref : Option < ty:: TraitRef < ' tcx > > ,
472
471
_ns : Namespace ,
473
472
) -> Result < Self :: Path , Self :: Error > {
474
473
Err ( NonTrivialPath )
475
474
}
476
- fn path_append (
477
- self : & mut PrintCx < ' _ , ' _ , ' _ , Self > ,
478
- mut path : Self :: Path ,
475
+
476
+ fn path_append_impl < ' gcx , ' tcx > (
477
+ self : PrintCx < ' _ , ' gcx , ' tcx , Self > ,
478
+ _print_prefix : impl FnOnce (
479
+ PrintCx < ' _ , ' gcx , ' tcx , Self > ,
480
+ ) -> Result < Self :: Path , Self :: Error > ,
481
+ _self_ty : Ty < ' tcx > ,
482
+ _trait_ref : Option < ty:: TraitRef < ' tcx > > ,
483
+ ) -> Result < Self :: Path , Self :: Error > {
484
+ Err ( NonTrivialPath )
485
+ }
486
+ fn path_append < ' gcx , ' tcx > (
487
+ self : PrintCx < ' _ , ' gcx , ' tcx , Self > ,
488
+ print_prefix : impl FnOnce (
489
+ PrintCx < ' _ , ' gcx , ' tcx , Self > ,
490
+ ) -> Result < Self :: Path , Self :: Error > ,
479
491
text : & str ,
480
492
) -> Result < Self :: Path , Self :: Error > {
493
+ let mut path = print_prefix ( self ) ?;
481
494
path. push ( text. to_string ( ) ) ;
482
495
Ok ( path)
483
496
}
484
- fn path_generic_args < ' tcx > (
485
- self : & mut PrintCx < ' _ , ' _ , ' tcx , Self > ,
486
- path : Self :: Path ,
497
+ fn path_generic_args < ' gcx , ' tcx > (
498
+ self : PrintCx < ' _ , ' gcx , ' tcx , Self > ,
499
+ print_prefix : impl FnOnce (
500
+ PrintCx < ' _ , ' gcx , ' tcx , Self > ,
501
+ ) -> Result < Self :: Path , Self :: Error > ,
487
502
_params : & [ ty:: GenericParamDef ] ,
488
503
_substs : SubstsRef < ' tcx > ,
489
504
_ns : Namespace ,
490
505
_projections : impl Iterator < Item = ty:: ExistentialProjection < ' tcx > > ,
491
506
) -> Result < Self :: Path , Self :: Error > {
492
- Ok ( path )
507
+ print_prefix ( self )
493
508
}
494
509
}
495
510
@@ -498,7 +513,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
498
513
// module we could have false positives
499
514
if !( did1. is_local ( ) || did2. is_local ( ) ) && did1. krate != did2. krate {
500
515
let abs_path = |def_id| {
501
- PrintCx :: with ( self . tcx , AbsolutePathPrinter , |mut cx| {
516
+ PrintCx :: with ( self . tcx , AbsolutePathPrinter , |cx| {
502
517
cx. print_def_path ( def_id, None , Namespace :: TypeNS , iter:: empty ( ) )
503
518
} )
504
519
} ;
0 commit comments