Skip to content

Commit 93fd485

Browse files
committed
rustc: rename PrintContext to PrintCx.
1 parent c40411c commit 93fd485

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

src/librustc/infer/error_reporting/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
675675
}
676676

677677
/// For generic types with parameters with defaults, remove the parameters corresponding to
678-
/// the defaults. This repeats a lot of the logic found in `PrintContext::parameterized`.
678+
/// the defaults. This repeats a lot of the logic found in `PrintCx::parameterized`.
679679
fn strip_generic_default_params(
680680
&self,
681681
def_id: DefId,

src/librustc/ty/print.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl<'tcx> ty::fold::TypeVisitor<'tcx> for LateBoundRegionNameCollector {
2222
}
2323

2424
#[derive(Debug)]
25-
pub struct PrintContext {
25+
pub struct PrintCx {
2626
pub(crate) is_debug: bool,
2727
pub(crate) is_verbose: bool,
2828
pub(crate) identify_regions: bool,
@@ -31,12 +31,12 @@ pub struct PrintContext {
3131
pub(crate) binder_depth: usize,
3232
}
3333

34-
impl PrintContext {
34+
impl PrintCx {
3535
pub(crate) fn new() -> Self {
3636
ty::tls::with(|tcx| {
3737
let (is_verbose, identify_regions) =
3838
(tcx.sess.verbose(), tcx.sess.opts.debugging_opts.identify_regions);
39-
PrintContext {
39+
PrintCx {
4040
is_debug: false,
4141
is_verbose: is_verbose,
4242
identify_regions: identify_regions,
@@ -57,32 +57,32 @@ impl PrintContext {
5757
}
5858

5959
pub trait Print<'tcx> {
60-
fn print<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintContext) -> fmt::Result;
61-
fn print_to_string(&self, cx: &mut PrintContext) -> String {
60+
fn print<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintCx) -> fmt::Result;
61+
fn print_to_string(&self, cx: &mut PrintCx) -> String {
6262
let mut result = String::new();
6363
let _ = self.print(&mut result, cx);
6464
result
6565
}
66-
fn print_display<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintContext) -> fmt::Result {
66+
fn print_display<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintCx) -> fmt::Result {
6767
let old_debug = cx.is_debug;
6868
cx.is_debug = false;
6969
let result = self.print(f, cx);
7070
cx.is_debug = old_debug;
7171
result
7272
}
73-
fn print_display_to_string(&self, cx: &mut PrintContext) -> String {
73+
fn print_display_to_string(&self, cx: &mut PrintCx) -> String {
7474
let mut result = String::new();
7575
let _ = self.print_display(&mut result, cx);
7676
result
7777
}
78-
fn print_debug<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintContext) -> fmt::Result {
78+
fn print_debug<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintCx) -> fmt::Result {
7979
let old_debug = cx.is_debug;
8080
cx.is_debug = true;
8181
let result = self.print(f, cx);
8282
cx.is_debug = old_debug;
8383
result
8484
}
85-
fn print_debug_to_string(&self, cx: &mut PrintContext) -> String {
85+
fn print_debug_to_string(&self, cx: &mut PrintCx) -> String {
8686
let mut result = String::new();
8787
let _ = self.print_debug(&mut result, cx);
8888
result

src/librustc/util/ppaux.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use ty::{Param, Bound, RawPtr, Ref, Never, Tuple};
99
use ty::{Closure, Generator, GeneratorWitness, Foreign, Projection, Opaque};
1010
use ty::{Placeholder, UnnormalizedProjection, Dynamic, Int, Uint, Infer};
1111
use ty::{self, Ty, TyCtxt, TypeFoldable, GenericParamCount, GenericParamDefKind};
12-
use ty::print::{PrintContext, Print};
12+
use ty::print::{PrintCx, Print};
1313

1414
use std::cell::Cell;
1515
use std::fmt;
@@ -182,7 +182,7 @@ impl RegionHighlightMode {
182182
macro_rules! gen_display_debug_body {
183183
( $with:path ) => {
184184
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
185-
let mut cx = PrintContext::new();
185+
let mut cx = PrintCx::new();
186186
$with(self, f, &mut cx)
187187
}
188188
};
@@ -213,15 +213,15 @@ macro_rules! gen_display_debug {
213213
macro_rules! gen_print_impl {
214214
( ($($x:tt)+) $target:ty, ($self:ident, $f:ident, $cx:ident) $disp:block $dbg:block ) => {
215215
impl<$($x)+> Print<'tcx> for $target {
216-
fn print<F: fmt::Write>(&$self, $f: &mut F, $cx: &mut PrintContext) -> fmt::Result {
216+
fn print<F: fmt::Write>(&$self, $f: &mut F, $cx: &mut PrintCx) -> fmt::Result {
217217
if $cx.is_debug $dbg
218218
else $disp
219219
}
220220
}
221221
};
222222
( () $target:ty, ($self:ident, $f:ident, $cx:ident) $disp:block $dbg:block ) => {
223223
impl Print<'tcx> for $target {
224-
fn print<F: fmt::Write>(&$self, $f: &mut F, $cx: &mut PrintContext) -> fmt::Result {
224+
fn print<F: fmt::Write>(&$self, $f: &mut F, $cx: &mut PrintCx) -> fmt::Result {
225225
if $cx.is_debug $dbg
226226
else $disp
227227
}
@@ -275,7 +275,7 @@ macro_rules! print {
275275
};
276276
}
277277

278-
impl PrintContext {
278+
impl PrintCx {
279279
fn fn_sig<F: fmt::Write>(&mut self,
280280
f: &mut F,
281281
inputs: &[Ty<'_>],
@@ -608,11 +608,11 @@ pub fn parameterized<F: fmt::Write>(f: &mut F,
608608
did: DefId,
609609
projections: &[ty::ProjectionPredicate<'_>])
610610
-> fmt::Result {
611-
PrintContext::new().parameterized(f, substs, did, projections)
611+
PrintCx::new().parameterized(f, substs, did, projections)
612612
}
613613

614614
impl<'a, 'tcx, T: Print<'tcx>> Print<'tcx> for &'a T {
615-
fn print<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintContext) -> fmt::Result {
615+
fn print<F: fmt::Write>(&self, f: &mut F, cx: &mut PrintCx) -> fmt::Result {
616616
(*self).print(f, cx)
617617
}
618618
}

0 commit comments

Comments
 (0)