Skip to content

Commit 9cb4e64

Browse files
compiler-errorsrcvalle
authored andcommitted
Naming nits
1 parent 698968a commit 9cb4e64

File tree

7 files changed

+55
-55
lines changed

7 files changed

+55
-55
lines changed

compiler/rustc_middle/src/ty/list.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,8 @@ impl<T: fmt::Debug> fmt::Debug for List<T> {
121121
}
122122
}
123123
impl<'tcx, T: super::DebugWithInfcx<TyCtxt<'tcx>>> super::DebugWithInfcx<TyCtxt<'tcx>> for List<T> {
124-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
125-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
124+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
125+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
126126
f: &mut core::fmt::Formatter<'_>,
127127
) -> core::fmt::Result {
128128
fmt::Debug::fmt(&this.map(|this| this.as_slice()), f)

compiler/rustc_middle/src/ty/structural_impls.rs

+22-22
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,8 @@ impl<'tcx> fmt::Debug for ty::FnSig<'tcx> {
9191
}
9292
}
9393
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::FnSig<'tcx> {
94-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
95-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
94+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
95+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
9696
f: &mut core::fmt::Formatter<'_>,
9797
) -> core::fmt::Result {
9898
let sig = this.data;
@@ -147,8 +147,8 @@ impl<'tcx> fmt::Debug for ty::TraitRef<'tcx> {
147147
}
148148

149149
impl<'tcx> ty::DebugWithInfcx<TyCtxt<'tcx>> for Ty<'tcx> {
150-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
151-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
150+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
151+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
152152
f: &mut core::fmt::Formatter<'_>,
153153
) -> core::fmt::Result {
154154
this.data.fmt(f)
@@ -240,8 +240,8 @@ impl<'tcx> fmt::Debug for AliasTy<'tcx> {
240240
}
241241
}
242242
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for AliasTy<'tcx> {
243-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
244-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
243+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
244+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
245245
f: &mut core::fmt::Formatter<'_>,
246246
) -> core::fmt::Result {
247247
f.debug_struct("AliasTy")
@@ -261,8 +261,8 @@ impl<'tcx> fmt::Debug for ty::InferConst<'tcx> {
261261
}
262262
}
263263
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::InferConst<'tcx> {
264-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
265-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
264+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
265+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
266266
f: &mut core::fmt::Formatter<'_>,
267267
) -> core::fmt::Result {
268268
use ty::InferConst::*;
@@ -285,8 +285,8 @@ impl<'tcx> fmt::Debug for ty::consts::Expr<'tcx> {
285285
}
286286
}
287287
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::consts::Expr<'tcx> {
288-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
289-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
288+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
289+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
290290
f: &mut core::fmt::Formatter<'_>,
291291
) -> core::fmt::Result {
292292
match this.data {
@@ -318,8 +318,8 @@ impl<'tcx> fmt::Debug for ty::UnevaluatedConst<'tcx> {
318318
}
319319
}
320320
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::UnevaluatedConst<'tcx> {
321-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
322-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
321+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
322+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
323323
f: &mut core::fmt::Formatter<'_>,
324324
) -> core::fmt::Result {
325325
f.debug_struct("UnevaluatedConst")
@@ -335,8 +335,8 @@ impl<'tcx> fmt::Debug for ty::Const<'tcx> {
335335
}
336336
}
337337
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::Const<'tcx> {
338-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
339-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
338+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
339+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
340340
f: &mut core::fmt::Formatter<'_>,
341341
) -> core::fmt::Result {
342342
// If this is a value, we spend some effort to make it look nice.
@@ -392,8 +392,8 @@ impl<'tcx> fmt::Debug for GenericArg<'tcx> {
392392
}
393393
}
394394
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for GenericArg<'tcx> {
395-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
396-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
395+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
396+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
397397
f: &mut core::fmt::Formatter<'_>,
398398
) -> core::fmt::Result {
399399
match this.data.unpack() {
@@ -410,17 +410,17 @@ impl<'tcx> fmt::Debug for Region<'tcx> {
410410
}
411411
}
412412
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for Region<'tcx> {
413-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
414-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
413+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
414+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
415415
f: &mut core::fmt::Formatter<'_>,
416416
) -> core::fmt::Result {
417417
write!(f, "{:?}", &this.map(|data| data.kind()))
418418
}
419419
}
420420

421421
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::RegionVid {
422-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
423-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
422+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
423+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
424424
f: &mut core::fmt::Formatter<'_>,
425425
) -> core::fmt::Result {
426426
match this.infcx.and_then(|infcx| infcx.universe_of_lt(*this.data)) {
@@ -431,8 +431,8 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ty::RegionVid {
431431
}
432432

433433
impl<'tcx, T: DebugWithInfcx<TyCtxt<'tcx>>> DebugWithInfcx<TyCtxt<'tcx>> for ty::Binder<'tcx, T> {
434-
fn fmt<InfCtx: InferCtxtLike<TyCtxt<'tcx>>>(
435-
this: OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
434+
fn fmt<Infcx: InferCtxtLike<TyCtxt<'tcx>>>(
435+
this: OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
436436
f: &mut core::fmt::Formatter<'_>,
437437
) -> core::fmt::Result {
438438
f.debug_tuple("Binder")

compiler/rustc_middle/src/ty/sty.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -683,8 +683,8 @@ pub enum ExistentialPredicate<'tcx> {
683683
}
684684

685685
impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for ExistentialPredicate<'tcx> {
686-
fn fmt<InfCtx: rustc_type_ir::InferCtxtLike<TyCtxt<'tcx>>>(
687-
this: rustc_type_ir::OptWithInfcx<'_, TyCtxt<'tcx>, InfCtx, &Self>,
686+
fn fmt<Infcx: rustc_type_ir::InferCtxtLike<TyCtxt<'tcx>>>(
687+
this: rustc_type_ir::OptWithInfcx<'_, TyCtxt<'tcx>, Infcx, &Self>,
688688
f: &mut core::fmt::Formatter<'_>,
689689
) -> core::fmt::Result {
690690
fmt::Debug::fmt(&this.data, f)

compiler/rustc_type_ir/src/const_kind.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -231,13 +231,13 @@ impl<I: Interner> Clone for ConstKind<I> {
231231

232232
impl<I: Interner> fmt::Debug for ConstKind<I> {
233233
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
234-
OptWithInfcx::new_no_ctx(self).fmt(f)
234+
OptWithInfcx::with_no_infcx(self).fmt(f)
235235
}
236236
}
237237

238238
impl<I: Interner> DebugWithInfcx<I> for ConstKind<I> {
239-
fn fmt<InfCtx: InferCtxtLike<I>>(
240-
this: OptWithInfcx<'_, I, InfCtx, &Self>,
239+
fn fmt<Infcx: InferCtxtLike<I>>(
240+
this: OptWithInfcx<'_, I, Infcx, &Self>,
241241
f: &mut core::fmt::Formatter<'_>,
242242
) -> core::fmt::Result {
243243
use ConstKind::*;

compiler/rustc_type_ir/src/debug.rs

+18-18
Original file line numberDiff line numberDiff line change
@@ -26,24 +26,24 @@ impl<I: Interner> InferCtxtLike<I> for core::convert::Infallible {
2626
}
2727

2828
pub trait DebugWithInfcx<I: Interner>: fmt::Debug {
29-
fn fmt<InfCtx: InferCtxtLike<I>>(
30-
this: OptWithInfcx<'_, I, InfCtx, &Self>,
29+
fn fmt<Infcx: InferCtxtLike<I>>(
30+
this: OptWithInfcx<'_, I, Infcx, &Self>,
3131
f: &mut fmt::Formatter<'_>,
3232
) -> fmt::Result;
3333
}
3434

3535
impl<I: Interner, T: DebugWithInfcx<I> + ?Sized> DebugWithInfcx<I> for &'_ T {
36-
fn fmt<InfCtx: InferCtxtLike<I>>(
37-
this: OptWithInfcx<'_, I, InfCtx, &Self>,
36+
fn fmt<Infcx: InferCtxtLike<I>>(
37+
this: OptWithInfcx<'_, I, Infcx, &Self>,
3838
f: &mut fmt::Formatter<'_>,
3939
) -> fmt::Result {
4040
<T as DebugWithInfcx<I>>::fmt(this.map(|&data| data), f)
4141
}
4242
}
4343

4444
impl<I: Interner, T: DebugWithInfcx<I>> DebugWithInfcx<I> for [T] {
45-
fn fmt<InfCtx: InferCtxtLike<I>>(
46-
this: OptWithInfcx<'_, I, InfCtx, &Self>,
45+
fn fmt<Infcx: InferCtxtLike<I>>(
46+
this: OptWithInfcx<'_, I, Infcx, &Self>,
4747
f: &mut fmt::Formatter<'_>,
4848
) -> fmt::Result {
4949
match f.alternate() {
@@ -70,46 +70,46 @@ impl<I: Interner, T: DebugWithInfcx<I>> DebugWithInfcx<I> for [T] {
7070
}
7171
}
7272

73-
pub struct OptWithInfcx<'a, I: Interner, InfCtx: InferCtxtLike<I>, T> {
73+
pub struct OptWithInfcx<'a, I: Interner, Infcx: InferCtxtLike<I>, T> {
7474
pub data: T,
75-
pub infcx: Option<&'a InfCtx>,
75+
pub infcx: Option<&'a Infcx>,
7676
_interner: PhantomData<I>,
7777
}
7878

79-
impl<I: Interner, InfCtx: InferCtxtLike<I>, T: Copy> Copy for OptWithInfcx<'_, I, InfCtx, T> {}
79+
impl<I: Interner, Infcx: InferCtxtLike<I>, T: Copy> Copy for OptWithInfcx<'_, I, Infcx, T> {}
8080

81-
impl<I: Interner, InfCtx: InferCtxtLike<I>, T: Clone> Clone for OptWithInfcx<'_, I, InfCtx, T> {
81+
impl<I: Interner, Infcx: InferCtxtLike<I>, T: Clone> Clone for OptWithInfcx<'_, I, Infcx, T> {
8282
fn clone(&self) -> Self {
8383
Self { data: self.data.clone(), infcx: self.infcx, _interner: self._interner }
8484
}
8585
}
8686

8787
impl<'a, I: Interner, T> OptWithInfcx<'a, I, core::convert::Infallible, T> {
88-
pub fn new_no_ctx(data: T) -> Self {
88+
pub fn with_no_infcx(data: T) -> Self {
8989
Self { data, infcx: None, _interner: PhantomData }
9090
}
9191
}
9292

93-
impl<'a, I: Interner, InfCtx: InferCtxtLike<I>, T> OptWithInfcx<'a, I, InfCtx, T> {
94-
pub fn new(data: T, infcx: &'a InfCtx) -> Self {
93+
impl<'a, I: Interner, Infcx: InferCtxtLike<I>, T> OptWithInfcx<'a, I, Infcx, T> {
94+
pub fn new(data: T, infcx: &'a Infcx) -> Self {
9595
Self { data, infcx: Some(infcx), _interner: PhantomData }
9696
}
9797

98-
pub fn wrap<U>(self, u: U) -> OptWithInfcx<'a, I, InfCtx, U> {
98+
pub fn wrap<U>(self, u: U) -> OptWithInfcx<'a, I, Infcx, U> {
9999
OptWithInfcx { data: u, infcx: self.infcx, _interner: PhantomData }
100100
}
101101

102-
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> OptWithInfcx<'a, I, InfCtx, U> {
102+
pub fn map<U>(self, f: impl FnOnce(T) -> U) -> OptWithInfcx<'a, I, Infcx, U> {
103103
OptWithInfcx { data: f(self.data), infcx: self.infcx, _interner: PhantomData }
104104
}
105105

106-
pub fn as_ref(&self) -> OptWithInfcx<'a, I, InfCtx, &T> {
106+
pub fn as_ref(&self) -> OptWithInfcx<'a, I, Infcx, &T> {
107107
OptWithInfcx { data: &self.data, infcx: self.infcx, _interner: PhantomData }
108108
}
109109
}
110110

111-
impl<I: Interner, InfCtx: InferCtxtLike<I>, T: DebugWithInfcx<I>> fmt::Debug
112-
for OptWithInfcx<'_, I, InfCtx, T>
111+
impl<I: Interner, Infcx: InferCtxtLike<I>, T: DebugWithInfcx<I>> fmt::Debug
112+
for OptWithInfcx<'_, I, Infcx, T>
113113
{
114114
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
115115
DebugWithInfcx::fmt(self.as_ref(), f)

compiler/rustc_type_ir/src/region_kind.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ impl<I: Interner> hash::Hash for RegionKind<I> {
274274
}
275275

276276
impl<I: Interner> DebugWithInfcx<I> for RegionKind<I> {
277-
fn fmt<InfCtx: InferCtxtLike<I>>(
278-
this: OptWithInfcx<'_, I, InfCtx, &Self>,
277+
fn fmt<Infcx: InferCtxtLike<I>>(
278+
this: OptWithInfcx<'_, I, Infcx, &Self>,
279279
f: &mut core::fmt::Formatter<'_>,
280280
) -> core::fmt::Result {
281281
match this.data {
@@ -301,7 +301,7 @@ impl<I: Interner> DebugWithInfcx<I> for RegionKind<I> {
301301
}
302302
impl<I: Interner> fmt::Debug for RegionKind<I> {
303303
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
304-
OptWithInfcx::new_no_ctx(self).fmt(f)
304+
OptWithInfcx::with_no_infcx(self).fmt(f)
305305
}
306306
}
307307

compiler/rustc_type_ir/src/ty_kind.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -534,8 +534,8 @@ impl<I: Interner> hash::Hash for TyKind<I> {
534534
}
535535

536536
impl<I: Interner> DebugWithInfcx<I> for TyKind<I> {
537-
fn fmt<InfCtx: InferCtxtLike<I>>(
538-
this: OptWithInfcx<'_, I, InfCtx, &Self>,
537+
fn fmt<Infcx: InferCtxtLike<I>>(
538+
this: OptWithInfcx<'_, I, Infcx, &Self>,
539539
f: &mut core::fmt::Formatter<'_>,
540540
) -> fmt::Result {
541541
match this.data {
@@ -617,7 +617,7 @@ impl<I: Interner> DebugWithInfcx<I> for TyKind<I> {
617617
// This is manually implemented because a derive would require `I: Debug`
618618
impl<I: Interner> fmt::Debug for TyKind<I> {
619619
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
620-
OptWithInfcx::new_no_ctx(self).fmt(f)
620+
OptWithInfcx::with_no_infcx(self).fmt(f)
621621
}
622622
}
623623

@@ -1239,8 +1239,8 @@ impl fmt::Debug for InferTy {
12391239
}
12401240

12411241
impl<I: Interner<InferTy = InferTy>> DebugWithInfcx<I> for InferTy {
1242-
fn fmt<InfCtx: InferCtxtLike<I>>(
1243-
this: OptWithInfcx<'_, I, InfCtx, &Self>,
1242+
fn fmt<Infcx: InferCtxtLike<I>>(
1243+
this: OptWithInfcx<'_, I, Infcx, &Self>,
12441244
f: &mut fmt::Formatter<'_>,
12451245
) -> fmt::Result {
12461246
use InferTy::*;

0 commit comments

Comments
 (0)