@@ -245,15 +245,15 @@ impl<'tcx> RegionHighlightMode<'tcx> {
245
245
/// Trait for printers that pretty-print using `fmt::Write` to the printer.
246
246
pub trait PrettyPrinter < ' tcx > : Printer < ' tcx > + fmt:: Write {
247
247
/// Like `print_def_path` but for value paths.
248
- fn print_value_path (
248
+ fn pretty_print_value_path (
249
249
& mut self ,
250
250
def_id : DefId ,
251
251
args : & ' tcx [ GenericArg < ' tcx > ] ,
252
252
) -> Result < ( ) , PrintError > {
253
253
self . print_def_path ( def_id, args)
254
254
}
255
255
256
- fn print_in_binder < T > ( & mut self , value : & ty:: Binder < ' tcx , T > ) -> Result < ( ) , PrintError >
256
+ fn pretty_print_in_binder < T > ( & mut self , value : & ty:: Binder < ' tcx , T > ) -> Result < ( ) , PrintError >
257
257
where
258
258
T : Print < ' tcx , Self > + TypeFoldable < TyCtxt < ' tcx > > ,
259
259
{
@@ -644,7 +644,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
644
644
Ok ( true )
645
645
}
646
646
647
- fn pretty_path_qualified (
647
+ fn pretty_print_path_with_qualified (
648
648
& mut self ,
649
649
self_ty : Ty < ' tcx > ,
650
650
trait_ref : Option < ty:: TraitRef < ' tcx > > ,
@@ -679,7 +679,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
679
679
} )
680
680
}
681
681
682
- fn pretty_path_append_impl (
682
+ fn pretty_print_path_with_impl (
683
683
& mut self ,
684
684
print_prefix : impl FnOnce ( & mut Self ) -> Result < ( ) , PrintError > ,
685
685
self_ty : Ty < ' tcx > ,
@@ -746,7 +746,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
746
746
}
747
747
sig. print ( self ) ?;
748
748
write ! ( self , " {{" ) ?;
749
- self . print_value_path ( def_id, args) ?;
749
+ self . pretty_print_value_path ( def_id, args) ?;
750
750
write ! ( self , "}}" ) ?;
751
751
}
752
752
}
@@ -1393,7 +1393,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1393
1393
if let ty:: Tuple ( tys) = principal. args . type_at ( 0 ) . kind ( ) {
1394
1394
let mut projections = predicates. projection_bounds ( ) ;
1395
1395
if let ( Some ( proj) , None ) = ( projections. next ( ) , projections. next ( ) ) {
1396
- p. pretty_fn_sig (
1396
+ p. pretty_print_fn_sig (
1397
1397
tys,
1398
1398
false ,
1399
1399
proj. skip_binder ( ) . term . as_type ( ) . expect ( "Return type was a const" ) ,
@@ -1495,7 +1495,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1495
1495
Ok ( ( ) )
1496
1496
}
1497
1497
1498
- fn pretty_fn_sig (
1498
+ fn pretty_print_fn_sig (
1499
1499
& mut self ,
1500
1500
inputs : & [ Ty < ' tcx > ] ,
1501
1501
c_variadic : bool ,
@@ -1532,7 +1532,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1532
1532
ty:: ConstKind :: Unevaluated ( ty:: UnevaluatedConst { def, args } ) => {
1533
1533
match self . tcx ( ) . def_kind ( def) {
1534
1534
DefKind :: Const | DefKind :: AssocConst => {
1535
- self . print_value_path ( def, args) ?;
1535
+ self . pretty_print_value_path ( def, args) ?;
1536
1536
}
1537
1537
DefKind :: AnonConst => {
1538
1538
if def. is_local ( )
@@ -1541,13 +1541,13 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1541
1541
{
1542
1542
write ! ( self , "{snip}" ) ?;
1543
1543
} else {
1544
- // Do not call `print_value_path ` as if a parent of this anon const is
1545
- // an impl it will attempt to print out the impl trait ref i.e. `<T as
1546
- // Trait>::{constant#0}`. This would cause printing to enter an
1547
- // infinite recursion if the anon const is in the self type i.e.
1548
- // `impl<T: Default> Default for [T; 32 - 1 - 1 - 1] {` where we would
1549
- // try to print
1550
- // `<[T; /* print constant#0 again */] as // Default>::{constant#0}`.
1544
+ // Do not call `pretty_print_value_path ` as if a parent of this anon
1545
+ // const is an impl it will attempt to print out the impl trait ref
1546
+ // i.e. `<T as Trait>::{constant#0}`. This would cause printing to
1547
+ // enter an infinite recursion if the anon const is in the self type
1548
+ // i.e. `impl<T: Default> Default for [T; 32 - 1 - 1 - 1] {` where we
1549
+ // would try to print `<[T; /* print constant#0 again */] as //
1550
+ // Default>::{constant#0}`.
1551
1551
write ! (
1552
1552
self ,
1553
1553
"{}::{}" ,
@@ -1749,7 +1749,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1749
1749
self . tcx ( ) . try_get_global_alloc ( prov. alloc_id ( ) )
1750
1750
{
1751
1751
self . typed_value (
1752
- |this| this. print_value_path ( instance. def_id ( ) , instance. args ) ,
1752
+ |this| this. pretty_print_value_path ( instance. def_id ( ) , instance. args ) ,
1753
1753
|this| this. print_type ( ty) ,
1754
1754
" as " ,
1755
1755
) ?;
@@ -1943,7 +1943,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1943
1943
let variant_idx =
1944
1944
contents. variant . expect ( "destructed const of adt without variant idx" ) ;
1945
1945
let variant_def = & def. variant ( variant_idx) ;
1946
- self . print_value_path ( variant_def. def_id , args) ?;
1946
+ self . pretty_print_value_path ( variant_def. def_id , args) ?;
1947
1947
match variant_def. ctor_kind ( ) {
1948
1948
Some ( CtorKind :: Const ) => { }
1949
1949
Some ( CtorKind :: Fn ) => {
@@ -1979,7 +1979,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
1979
1979
}
1980
1980
( _, ty:: FnDef ( def_id, args) ) => {
1981
1981
// Never allowed today, but we still encounter them in invalid const args.
1982
- self . print_value_path ( def_id, args) ?;
1982
+ self . pretty_print_value_path ( def_id, args) ?;
1983
1983
return Ok ( ( ) ) ;
1984
1984
}
1985
1985
// FIXME(oli-obk): also pretty print arrays and other aggregate constants by reading
@@ -2000,7 +2000,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
2000
2000
Ok ( ( ) )
2001
2001
}
2002
2002
2003
- fn pretty_closure_as_impl (
2003
+ fn pretty_print_closure_as_impl (
2004
2004
& mut self ,
2005
2005
closure : ty:: ClosureArgs < TyCtxt < ' tcx > > ,
2006
2006
) -> Result < ( ) , PrintError > {
@@ -2335,7 +2335,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2335
2335
self_ty : Ty < ' tcx > ,
2336
2336
trait_ref : Option < ty:: TraitRef < ' tcx > > ,
2337
2337
) -> Result < ( ) , PrintError > {
2338
- self . pretty_path_qualified ( self_ty, trait_ref) ?;
2338
+ self . pretty_print_path_with_qualified ( self_ty, trait_ref) ?;
2339
2339
self . empty_path = false ;
2340
2340
Ok ( ( ) )
2341
2341
}
@@ -2346,7 +2346,7 @@ impl<'tcx> Printer<'tcx> for FmtPrinter<'_, 'tcx> {
2346
2346
self_ty : Ty < ' tcx > ,
2347
2347
trait_ref : Option < ty:: TraitRef < ' tcx > > ,
2348
2348
) -> Result < ( ) , PrintError > {
2349
- self . pretty_path_append_impl (
2349
+ self . pretty_print_path_with_impl (
2350
2350
|p| {
2351
2351
print_prefix ( p) ?;
2352
2352
if !p. empty_path {
@@ -2424,7 +2424,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
2424
2424
self . 0 . const_infer_name_resolver . as_ref ( ) . and_then ( |func| func ( id) )
2425
2425
}
2426
2426
2427
- fn print_value_path (
2427
+ fn pretty_print_value_path (
2428
2428
& mut self ,
2429
2429
def_id : DefId ,
2430
2430
args : & ' tcx [ GenericArg < ' tcx > ] ,
@@ -2436,7 +2436,7 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
2436
2436
Ok ( ( ) )
2437
2437
}
2438
2438
2439
- fn print_in_binder < T > ( & mut self , value : & ty:: Binder < ' tcx , T > ) -> Result < ( ) , PrintError >
2439
+ fn pretty_print_in_binder < T > ( & mut self , value : & ty:: Binder < ' tcx , T > ) -> Result < ( ) , PrintError >
2440
2440
where
2441
2441
T : Print < ' tcx , Self > + TypeFoldable < TyCtxt < ' tcx > > ,
2442
2442
{
@@ -2899,7 +2899,7 @@ where
2899
2899
T : Print < ' tcx , P > + TypeFoldable < TyCtxt < ' tcx > > ,
2900
2900
{
2901
2901
fn print ( & self , p : & mut P ) -> Result < ( ) , PrintError > {
2902
- p. print_in_binder ( self )
2902
+ p. pretty_print_in_binder ( self )
2903
2903
}
2904
2904
}
2905
2905
@@ -3097,7 +3097,7 @@ define_print! {
3097
3097
}
3098
3098
3099
3099
write!( p, "fn" ) ?;
3100
- p. pretty_fn_sig ( self . inputs( ) , self . c_variadic, self . output( ) ) ?;
3100
+ p. pretty_print_fn_sig ( self . inputs( ) , self . c_variadic, self . output( ) ) ?;
3101
3101
}
3102
3102
3103
3103
ty:: TraitRef <' tcx> {
@@ -3321,7 +3321,7 @@ define_print_and_forward_display! {
3321
3321
}
3322
3322
3323
3323
PrintClosureAsImpl <' tcx> {
3324
- p. pretty_closure_as_impl ( self . closure) ?;
3324
+ p. pretty_print_closure_as_impl ( self . closure) ?;
3325
3325
}
3326
3326
3327
3327
ty:: ParamTy {
0 commit comments