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