@@ -474,7 +474,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
474
474
// path to the crate followed by the path to the item within the crate.
475
475
if let Some ( cnum) = def_id. as_crate_root ( ) {
476
476
if cnum == LOCAL_CRATE {
477
- self . path_crate ( cnum) ?;
477
+ self . print_crate_name ( cnum) ?;
478
478
return Ok ( true ) ;
479
479
}
480
480
@@ -498,7 +498,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
498
498
// or avoid ending up with `ExternCrateSource::Extern`,
499
499
// for the injected `std`/`core`.
500
500
if span. is_dummy ( ) {
501
- self . path_crate ( cnum) ?;
501
+ self . print_crate_name ( cnum) ?;
502
502
return Ok ( true ) ;
503
503
}
504
504
@@ -512,13 +512,13 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
512
512
return Ok ( true ) ;
513
513
}
514
514
( ExternCrateSource :: Path , LOCAL_CRATE ) => {
515
- self . path_crate ( cnum) ?;
515
+ self . print_crate_name ( cnum) ?;
516
516
return Ok ( true ) ;
517
517
}
518
518
_ => { }
519
519
} ,
520
520
None => {
521
- self . path_crate ( cnum) ?;
521
+ self . print_crate_name ( cnum) ?;
522
522
return Ok ( true ) ;
523
523
}
524
524
}
@@ -628,7 +628,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
628
628
return Ok ( false ) ;
629
629
}
630
630
callers. push ( visible_parent) ;
631
- // HACK(eddyb) this bypasses `path_append `'s prefix printing to avoid
631
+ // HACK(eddyb) this bypasses `print_path_with_simple `'s prefix printing to avoid
632
632
// knowing ahead of time whether the entire path will succeed or not.
633
633
// To support printers that do not implement `PrettyPrinter`, a `Vec` or
634
634
// linked list on the stack would need to be built, before any printing.
@@ -637,7 +637,10 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
637
637
true => { }
638
638
}
639
639
callers. pop ( ) ;
640
- self . path_append ( |_| Ok ( ( ) ) , & DisambiguatedDefPathData { data, disambiguator : 0 } ) ?;
640
+ self . print_path_with_simple (
641
+ |_| Ok ( ( ) ) ,
642
+ & DisambiguatedDefPathData { data, disambiguator : 0 } ,
643
+ ) ?;
641
644
Ok ( true )
642
645
}
643
646
@@ -1312,10 +1315,10 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1312
1315
alias_ty : ty:: AliasTerm < ' tcx > ,
1313
1316
) -> Result < ( ) , PrintError > {
1314
1317
let def_key = self . tcx ( ) . def_key ( alias_ty. def_id ) ;
1315
- self . path_generic_args (
1318
+ self . print_path_with_generic_args (
1316
1319
|p| {
1317
- p. path_append (
1318
- |p| p. path_qualified ( alias_ty. self_ty ( ) , None ) ,
1320
+ p. print_path_with_simple (
1321
+ |p| p. print_path_with_qualified ( alias_ty. self_ty ( ) , None ) ,
1319
1322
& def_key. disambiguated_data ,
1320
1323
)
1321
1324
} ,
@@ -1400,7 +1403,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1400
1403
}
1401
1404
}
1402
1405
1403
- // HACK(eddyb) this duplicates `FmtPrinter`'s `path_generic_args `,
1406
+ // HACK(eddyb) this duplicates `FmtPrinter`'s `print_path_with_generic_args `,
1404
1407
// in order to place the projections inside the `<...>`.
1405
1408
if !resugared {
1406
1409
let principal_with_self =
@@ -2234,7 +2237,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2234
2237
2235
2238
self . print_def_path ( parent_def_id, & [ ] ) ?;
2236
2239
2237
- // HACK(eddyb) copy of `path_append ` to avoid
2240
+ // HACK(eddyb) copy of `print_path_with_simple ` to avoid
2238
2241
// constructing a `DisambiguatedDefPathData`.
2239
2242
if !self . empty_path {
2240
2243
write ! ( self , "::" ) ?;
@@ -2310,7 +2313,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2310
2313
self . pretty_print_const ( ct, false )
2311
2314
}
2312
2315
2313
- fn path_crate ( & mut self , cnum : CrateNum ) -> Result < ( ) , PrintError > {
2316
+ fn print_crate_name ( & mut self , cnum : CrateNum ) -> Result < ( ) , PrintError > {
2314
2317
self . empty_path = true ;
2315
2318
if cnum == LOCAL_CRATE {
2316
2319
if self . tcx . sess . at_least_rust_2018 ( ) {
@@ -2327,7 +2330,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2327
2330
Ok ( ( ) )
2328
2331
}
2329
2332
2330
- fn path_qualified (
2333
+ fn print_path_with_qualified (
2331
2334
& mut self ,
2332
2335
self_ty : Ty < ' tcx > ,
2333
2336
trait_ref : Option < ty:: TraitRef < ' tcx > > ,
@@ -2337,7 +2340,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2337
2340
Ok ( ( ) )
2338
2341
}
2339
2342
2340
- fn path_append_impl (
2343
+ fn print_path_with_impl (
2341
2344
& mut self ,
2342
2345
print_prefix : impl FnOnce ( & mut Self ) -> Result < ( ) , PrintError > ,
2343
2346
self_ty : Ty < ' tcx > ,
@@ -2359,7 +2362,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2359
2362
Ok ( ( ) )
2360
2363
}
2361
2364
2362
- fn path_append (
2365
+ fn print_path_with_simple (
2363
2366
& mut self ,
2364
2367
print_prefix : impl FnOnce ( & mut Self ) -> Result < ( ) , PrintError > ,
2365
2368
disambiguated_data : & DisambiguatedDefPathData ,
@@ -2390,7 +2393,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2390
2393
Ok ( ( ) )
2391
2394
}
2392
2395
2393
- fn path_generic_args (
2396
+ fn print_path_with_generic_args (
2394
2397
& mut self ,
2395
2398
print_prefix : impl FnOnce ( & mut Self ) -> Result < ( ) , PrintError > ,
2396
2399
args : & [ GenericArg < ' tcx > ] ,
@@ -3229,7 +3232,7 @@ define_print! {
3229
3232
// The args don't contain the self ty (as it has been erased) but the corresp.
3230
3233
// generics do as the trait always has a self ty param. We need to offset.
3231
3234
let args = & self . args[ p. tcx( ) . generics_of( self . def_id) . parent_count - 1 ..] ;
3232
- p. path_generic_args ( |p| write!( p, "{name}" ) , args) ?;
3235
+ p. print_path_with_generic_args ( |p| write!( p, "{name}" ) , args) ?;
3233
3236
write!( p, " = " ) ?;
3234
3237
self . term. print( p) ?;
3235
3238
}
0 commit comments