Skip to content

Commit f922929

Browse files
Use EarlyBinder in rustc_type_ir, simplify imports
1 parent 993553c commit f922929

3 files changed

Lines changed: 23 additions & 27 deletions

File tree

‎compiler/rustc_middle/src/ty/context.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
151151
self.generics_of(def_id)
152152
}
153153

154-
fntype_of_instantiated(self,def_id:DefId,args: ty::GenericArgsRef<'tcx>) -> Ty<'tcx>{
155-
self.type_of(def_id).instantiate(self, args)
154+
fntype_of(self,def_id:DefId) -> ty::EarlyBinder<'tcx,Ty<'tcx>>{
155+
self.type_of(def_id)
156156
}
157157

158158
fnalias_ty_kind(self,alias: ty::AliasTy<'tcx>) -> ty::AliasTyKind{

‎compiler/rustc_type_ir/src/interner.rs‎

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,26 +7,22 @@ use crate::inherent::*;
77
usecrate::ir_print::IrPrint;
88
usecrate::solve::inspect::CanonicalGoalEvaluationStep;
99
usecrate::visit::{Flags,TypeSuperVisitable,TypeVisitable};
10-
usecrate::{
11-
AliasTerm,AliasTermKind,AliasTy,AliasTyKind,CanonicalVarInfo,CoercePredicate,
12-
DebugWithInfcx,ExistentialProjection,ExistentialTraitRef,FnSig,GenericArgKind,
13-
NormalizesTo,ProjectionPredicate,SubtypePredicate,TermKind,TraitPredicate,TraitRef,
14-
};
10+
usecrate::{selfas ty,DebugWithInfcx};
1511

1612
pubtraitInterner:
1713
Sized
1814
+ Copy
19-
+ IrPrint<AliasTy<Self>>
20-
+ IrPrint<AliasTerm<Self>>
21-
+ IrPrint<TraitRef<Self>>
22-
+ IrPrint<TraitPredicate<Self>>
23-
+ IrPrint<ExistentialTraitRef<Self>>
24-
+ IrPrint<ExistentialProjection<Self>>
25-
+ IrPrint<ProjectionPredicate<Self>>
26-
+ IrPrint<NormalizesTo<Self>>
27-
+ IrPrint<SubtypePredicate<Self>>
28-
+ IrPrint<CoercePredicate<Self>>
29-
+ IrPrint<FnSig<Self>>
15+
+ IrPrint<ty::AliasTy<Self>>
16+
+ IrPrint<ty::AliasTerm<Self>>
17+
+ IrPrint<ty::TraitRef<Self>>
18+
+ IrPrint<ty::TraitPredicate<Self>>
19+
+ IrPrint<ty::ExistentialTraitRef<Self>>
20+
+ IrPrint<ty::ExistentialProjection<Self>>
21+
+ IrPrint<ty::ProjectionPredicate<Self>>
22+
+ IrPrint<ty::NormalizesTo<Self>>
23+
+ IrPrint<ty::SubtypePredicate<Self>>
24+
+ IrPrint<ty::CoercePredicate<Self>>
25+
+ IrPrint<ty::FnSig<Self>>
3026
{
3127
typeDefId:Copy + Debug + Hash + Eq + TypeVisitable<Self>;
3228
typeAdtDef:Copy + Debug + Hash + Eq;
@@ -39,9 +35,9 @@ pub trait Interner:
3935
+ DebugWithInfcx<Self>
4036
+ Hash
4137
+ Eq
42-
+ IntoKind<Kind = GenericArgKind<Self>>
38+
+ IntoKind<Kind = ty::GenericArgKind<Self>>
4339
+ TypeVisitable<Self>;
44-
typeTerm:Copy + Debug + Hash + Eq + IntoKind<Kind = TermKind<Self>> + TypeVisitable<Self>;
40+
typeTerm:Copy + Debug + Hash + Eq + IntoKind<Kind = ty::TermKind<Self>> + TypeVisitable<Self>;
4541

4642
typeBoundVarKinds:Copy
4743
+ Debug
@@ -51,7 +47,7 @@ pub trait Interner:
5147
+ Default;
5248
typeBoundVarKind:Copy + Debug + Hash + Eq;
5349

54-
typeCanonicalVars:Copy + Debug + Hash + Eq + IntoIterator<Item = CanonicalVarInfo<Self>>;
50+
typeCanonicalVars:Copy + Debug + Hash + Eq + IntoIterator<Item = ty::CanonicalVarInfo<Self>>;
5551
typePredefinedOpaques:Copy + Debug + Hash + Eq;
5652
typeDefiningOpaqueTypes:Copy + Debug + Hash + Default + Eq + TypeVisitable<Self>;
5753
typeExternalConstraints:Copy + Debug + Hash + Eq;
@@ -99,23 +95,23 @@ pub trait Interner:
9995
typeClause:Clause<Self>;
10096
typeClauses:Copy + Debug + Hash + Eq + TypeSuperVisitable<Self> + Flags;
10197

102-
fnmk_canonical_var_infos(self,infos:&[CanonicalVarInfo<Self>]) -> Self::CanonicalVars;
98+
fnmk_canonical_var_infos(self,infos:&[ty::CanonicalVarInfo<Self>]) -> Self::CanonicalVars;
10399

104100
typeGenericsOf:GenericsOf<Self>;
105101
fngenerics_of(self,def_id:Self::DefId) -> Self::GenericsOf;
106102

107103
// FIXME: Remove after uplifting `EarlyBinder`
108-
fntype_of_instantiated(self,def_id:Self::DefId,args:Self::GenericArgs) -> Self::Ty;
104+
fntype_of(self,def_id:Self::DefId) -> ty::EarlyBinder<Self,Self::Ty>;
109105

110-
fnalias_ty_kind(self,alias:AliasTy<Self>) -> AliasTyKind;
106+
fnalias_ty_kind(self,alias:ty::AliasTy<Self>) -> ty::AliasTyKind;
111107

112-
fnalias_term_kind(self,alias:AliasTerm<Self>) -> AliasTermKind;
108+
fnalias_term_kind(self,alias:ty::AliasTerm<Self>) -> ty::AliasTermKind;
113109

114110
fntrait_ref_and_own_args_for_alias(
115111
self,
116112
def_id:Self::DefId,
117113
args:Self::GenericArgs,
118-
) -> (TraitRef<Self>,Self::OwnItemArgs);
114+
) -> (ty::TraitRef<Self>,Self::OwnItemArgs);
119115

120116
fnmk_args(self,args:&[Self::GenericArg]) -> Self::GenericArgs;
121117

‎compiler/rustc_type_ir/src/predicate.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ impl<I: Interner> AliasTerm<I> {
567567
I::Const::new_unevaluated(
568568
interner,
569569
ty::UnevaluatedConst::new(self.def_id,self.args),
570-
interner.type_of_instantiated(self.def_id,self.args),
570+
interner.type_of(self.def_id).instantiate(interner,&self.args),
571571
)
572572
.into()
573573
}

0 commit comments

Comments
 (0)