Skip to content

Commit ee47480

Browse files
Yeet PolyFnSig from Interner
1 parent acaf0ae commit ee47480

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

compiler/rustc_middle/src/ty/context.rs

-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
113113

114114
type ErrorGuaranteed = ErrorGuaranteed;
115115
type BoundExistentialPredicates = &'tcx List<PolyExistentialPredicate<'tcx>>;
116-
type PolyFnSig = PolyFnSig<'tcx>;
117116
type AllocId = crate::mir::interpret::AllocId;
118117

119118
type Pat = Pattern<'tcx>;

compiler/rustc_middle/src/ty/structural_impls.rs

-12
Original file line numberDiff line numberDiff line change
@@ -259,18 +259,6 @@ impl<'tcx> DebugWithInfcx<TyCtxt<'tcx>> for Region<'tcx> {
259259
}
260260
}
261261

262-
impl<'tcx, T: DebugWithInfcx<TyCtxt<'tcx>>> DebugWithInfcx<TyCtxt<'tcx>> for ty::Binder<'tcx, T> {
263-
fn fmt<Infcx: InferCtxtLike<Interner = TyCtxt<'tcx>>>(
264-
this: WithInfcx<'_, Infcx, &Self>,
265-
f: &mut core::fmt::Formatter<'_>,
266-
) -> core::fmt::Result {
267-
f.debug_tuple("Binder")
268-
.field(&this.map(|data| data.as_ref().skip_binder()))
269-
.field(&this.data.bound_vars())
270-
.finish()
271-
}
272-
}
273-
274262
///////////////////////////////////////////////////////////////////////////
275263
// Atomic structs
276264
//

compiler/rustc_type_ir/src/binder.rs

+14-1
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@ use rustc_macros::{HashStable_NoContext, TyDecodable, TyEncodable};
88
use rustc_serialize::Decodable;
99
use tracing::debug;
1010

11+
use crate::debug::{DebugWithInfcx, WithInfcx};
1112
use crate::fold::{FallibleTypeFolder, TypeFoldable, TypeFolder, TypeSuperFoldable};
1213
use crate::inherent::*;
1314
use crate::lift::Lift;
1415
use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable, TypeVisitableExt, TypeVisitor};
15-
use crate::{self as ty, Interner, SsoHashSet};
16+
use crate::{self as ty, InferCtxtLike, Interner, SsoHashSet};
1617

1718
/// Binder is a binder for higher-ranked lifetimes or types. It is part of the
1819
/// compiler's representation for things like `for<'a> Fn(&'a isize)`
@@ -55,6 +56,18 @@ where
5556
}
5657
}
5758

59+
impl<I: Interner, T: DebugWithInfcx<I>> DebugWithInfcx<I> for ty::Binder<I, T> {
60+
fn fmt<Infcx: InferCtxtLike<Interner = I>>(
61+
this: WithInfcx<'_, Infcx, &Self>,
62+
f: &mut core::fmt::Formatter<'_>,
63+
) -> core::fmt::Result {
64+
f.debug_tuple("Binder")
65+
.field(&this.map(|data| data.as_ref().skip_binder()))
66+
.field(&this.data.bound_vars())
67+
.finish()
68+
}
69+
}
70+
5871
macro_rules! impl_binder_encode_decode {
5972
($($t:ty),+ $(,)?) => {
6073
$(

compiler/rustc_type_ir/src/interner.rs

-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ pub trait Interner:
6969
// Things stored inside of tys
7070
type ErrorGuaranteed: Copy + Debug + Hash + Eq;
7171
type BoundExistentialPredicates: Copy + DebugWithInfcx<Self> + Hash + Eq;
72-
type PolyFnSig: Copy + DebugWithInfcx<Self> + Hash + Eq;
7372
type AllocId: Copy + Debug + Hash + Eq;
7473
type Pat: Copy + Debug + Hash + Eq + DebugWithInfcx<Self>;
7574
type Safety: Safety<Self>;

compiler/rustc_type_ir/src/ty_kind.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ pub enum TyKind<I: Interner> {
141141
/// fn foo() -> i32 { 1 }
142142
/// let bar: fn() -> i32 = foo;
143143
/// ```
144-
FnPtr(I::PolyFnSig),
144+
FnPtr(ty::Binder<I, FnSig<I>>),
145145

146146
/// A trait object. Written as `dyn for<'b> Trait<'b, Assoc = u32> + Send + 'a`.
147147
Dynamic(I::BoundExistentialPredicates, I::Region, DynKind),

0 commit comments

Comments
 (0)