Skip to content

Commit a05a8c8

Browse files
Rename a bit
1 parent 83fa2fa commit a05a8c8

File tree

2 files changed

+10
-20
lines changed
  • compiler

2 files changed

+10
-20
lines changed

compiler/rustc_middle/src/ty/print/pretty.rs

+6-15
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,7 @@ pub trait PrettyPrinter<'tcx>: Printer<'tcx> + fmt::Write {
233233
self.print_def_path(def_id, args)
234234
}
235235

236-
fn in_binder<T>(
237-
&mut self,
238-
value: &ty::Binder<'tcx, T>,
239-
_mode: WrapBinderMode,
240-
) -> Result<(), PrintError>
236+
fn print_in_binder<T>(&mut self, value: &ty::Binder<'tcx, T>) -> Result<(), PrintError>
241237
where
242238
T: Print<'tcx, Self> + TypeFoldable<TyCtxt<'tcx>>,
243239
{
@@ -2391,15 +2387,11 @@ impl<'tcx> PrettyPrinter<'tcx> for FmtPrinter<'_, 'tcx> {
23912387
Ok(())
23922388
}
23932389

2394-
fn in_binder<T>(
2395-
&mut self,
2396-
value: &ty::Binder<'tcx, T>,
2397-
mode: WrapBinderMode,
2398-
) -> Result<(), PrintError>
2390+
fn print_in_binder<T>(&mut self, value: &ty::Binder<'tcx, T>) -> Result<(), PrintError>
23992391
where
24002392
T: Print<'tcx, Self> + TypeFoldable<TyCtxt<'tcx>>,
24012393
{
2402-
self.pretty_in_binder(value, mode)
2394+
self.pretty_print_in_binder(value)
24032395
}
24042396

24052397
fn wrap_binder<T, C: FnOnce(&T, &mut Self) -> Result<(), PrintError>>(
@@ -2835,16 +2827,15 @@ impl<'tcx> FmtPrinter<'_, 'tcx> {
28352827
Ok((new_value, map))
28362828
}
28372829

2838-
pub fn pretty_in_binder<T>(
2830+
pub fn pretty_print_in_binder<T>(
28392831
&mut self,
28402832
value: &ty::Binder<'tcx, T>,
2841-
mode: WrapBinderMode,
28422833
) -> Result<(), fmt::Error>
28432834
where
28442835
T: Print<'tcx, Self> + TypeFoldable<TyCtxt<'tcx>>,
28452836
{
28462837
let old_region_index = self.region_index;
2847-
let (new_value, _) = self.name_all_regions(value, mode)?;
2838+
let (new_value, _) = self.name_all_regions(value, WrapBinderMode::ForAll)?;
28482839
new_value.print(self)?;
28492840
self.region_index = old_region_index;
28502841
self.binder_depth -= 1;
@@ -2920,7 +2911,7 @@ where
29202911
T: Print<'tcx, P> + TypeFoldable<TyCtxt<'tcx>>,
29212912
{
29222913
fn print(&self, cx: &mut P) -> Result<(), PrintError> {
2923-
cx.in_binder(self, WrapBinderMode::ForAll)
2914+
cx.print_in_binder(self)
29242915
}
29252916
}
29262917

compiler/rustc_symbol_mangling/src/v0.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use rustc_hir::def_id::{CrateNum, DefId};
1212
use rustc_hir::definitions::{DefPathData, DisambiguatedDefPathData};
1313
use rustc_middle::bug;
1414
use rustc_middle::ty::layout::IntegerExt;
15-
use rustc_middle::ty::print::{Print, PrintError, Printer, WrapBinderMode};
15+
use rustc_middle::ty::print::{Print, PrintError, Printer};
1616
use rustc_middle::ty::{
1717
self, FloatTy, GenericArg, GenericArgKind, Instance, IntTy, ReifyReason, Ty, TyCtxt,
1818
TypeVisitable, TypeVisitableExt, UintTy,
@@ -169,10 +169,9 @@ impl<'tcx> SymbolMangler<'tcx> {
169169
Ok(())
170170
}
171171

172-
fn in_binder<T>(
172+
fn wrap_binder<T>(
173173
&mut self,
174174
value: &ty::Binder<'tcx, T>,
175-
_mode: WrapBinderMode,
176175
print_value: impl FnOnce(&mut Self, &T) -> Result<(), PrintError>,
177176
) -> Result<(), PrintError>
178177
where
@@ -472,7 +471,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
472471
ty::FnPtr(sig_tys, hdr) => {
473472
let sig = sig_tys.with(hdr);
474473
self.push("F");
475-
self.in_binder(&sig, WrapBinderMode::ForAll, |cx, sig| {
474+
self.wrap_binder(&sig, |cx, sig| {
476475
if sig.safety.is_unsafe() {
477476
cx.push("U");
478477
}
@@ -555,7 +554,7 @@ impl<'tcx> Printer<'tcx> for SymbolMangler<'tcx> {
555554
// [<Trait> [{<Projection>}]] [{<Auto>}]
556555
// Since any predicates after the first one shouldn't change the binders,
557556
// just put them all in the binders of the first.
558-
self.in_binder(&predicates[0], WrapBinderMode::ForAll, |cx, _| {
557+
self.wrap_binder(&predicates[0], |cx, _| {
559558
for predicate in predicates.iter() {
560559
// It would be nice to be able to validate bound vars here, but
561560
// projections can actually include bound vars from super traits

0 commit comments

Comments
 (0)