mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 16:24:46 +00:00
Use EarlyBinder in rustc_type_ir, simplify imports
This commit is contained in:
parent
993553ceb8
commit
f92292978f
@ -151,8 +151,8 @@ impl<'tcx> Interner for TyCtxt<'tcx> {
|
|||||||
self.generics_of(def_id)
|
self.generics_of(def_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn type_of_instantiated(self, def_id: DefId, args: ty::GenericArgsRef<'tcx>) -> Ty<'tcx> {
|
fn type_of(self, def_id: DefId) -> ty::EarlyBinder<'tcx, Ty<'tcx>> {
|
||||||
self.type_of(def_id).instantiate(self, args)
|
self.type_of(def_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn alias_ty_kind(self, alias: ty::AliasTy<'tcx>) -> ty::AliasTyKind {
|
fn alias_ty_kind(self, alias: ty::AliasTy<'tcx>) -> ty::AliasTyKind {
|
||||||
|
@ -7,26 +7,22 @@ use crate::inherent::*;
|
|||||||
use crate::ir_print::IrPrint;
|
use crate::ir_print::IrPrint;
|
||||||
use crate::solve::inspect::CanonicalGoalEvaluationStep;
|
use crate::solve::inspect::CanonicalGoalEvaluationStep;
|
||||||
use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable};
|
use crate::visit::{Flags, TypeSuperVisitable, TypeVisitable};
|
||||||
use crate::{
|
use crate::{self as ty, DebugWithInfcx};
|
||||||
AliasTerm, AliasTermKind, AliasTy, AliasTyKind, CanonicalVarInfo, CoercePredicate,
|
|
||||||
DebugWithInfcx, ExistentialProjection, ExistentialTraitRef, FnSig, GenericArgKind,
|
|
||||||
NormalizesTo, ProjectionPredicate, SubtypePredicate, TermKind, TraitPredicate, TraitRef,
|
|
||||||
};
|
|
||||||
|
|
||||||
pub trait Interner:
|
pub trait Interner:
|
||||||
Sized
|
Sized
|
||||||
+ Copy
|
+ Copy
|
||||||
+ IrPrint<AliasTy<Self>>
|
+ IrPrint<ty::AliasTy<Self>>
|
||||||
+ IrPrint<AliasTerm<Self>>
|
+ IrPrint<ty::AliasTerm<Self>>
|
||||||
+ IrPrint<TraitRef<Self>>
|
+ IrPrint<ty::TraitRef<Self>>
|
||||||
+ IrPrint<TraitPredicate<Self>>
|
+ IrPrint<ty::TraitPredicate<Self>>
|
||||||
+ IrPrint<ExistentialTraitRef<Self>>
|
+ IrPrint<ty::ExistentialTraitRef<Self>>
|
||||||
+ IrPrint<ExistentialProjection<Self>>
|
+ IrPrint<ty::ExistentialProjection<Self>>
|
||||||
+ IrPrint<ProjectionPredicate<Self>>
|
+ IrPrint<ty::ProjectionPredicate<Self>>
|
||||||
+ IrPrint<NormalizesTo<Self>>
|
+ IrPrint<ty::NormalizesTo<Self>>
|
||||||
+ IrPrint<SubtypePredicate<Self>>
|
+ IrPrint<ty::SubtypePredicate<Self>>
|
||||||
+ IrPrint<CoercePredicate<Self>>
|
+ IrPrint<ty::CoercePredicate<Self>>
|
||||||
+ IrPrint<FnSig<Self>>
|
+ IrPrint<ty::FnSig<Self>>
|
||||||
{
|
{
|
||||||
type DefId: Copy + Debug + Hash + Eq + TypeVisitable<Self>;
|
type DefId: Copy + Debug + Hash + Eq + TypeVisitable<Self>;
|
||||||
type AdtDef: Copy + Debug + Hash + Eq;
|
type AdtDef: Copy + Debug + Hash + Eq;
|
||||||
@ -39,9 +35,9 @@ pub trait Interner:
|
|||||||
+ DebugWithInfcx<Self>
|
+ DebugWithInfcx<Self>
|
||||||
+ Hash
|
+ Hash
|
||||||
+ Eq
|
+ Eq
|
||||||
+ IntoKind<Kind = GenericArgKind<Self>>
|
+ IntoKind<Kind = ty::GenericArgKind<Self>>
|
||||||
+ TypeVisitable<Self>;
|
+ TypeVisitable<Self>;
|
||||||
type Term: Copy + Debug + Hash + Eq + IntoKind<Kind = TermKind<Self>> + TypeVisitable<Self>;
|
type Term: Copy + Debug + Hash + Eq + IntoKind<Kind = ty::TermKind<Self>> + TypeVisitable<Self>;
|
||||||
|
|
||||||
type BoundVarKinds: Copy
|
type BoundVarKinds: Copy
|
||||||
+ Debug
|
+ Debug
|
||||||
@ -51,7 +47,7 @@ pub trait Interner:
|
|||||||
+ Default;
|
+ Default;
|
||||||
type BoundVarKind: Copy + Debug + Hash + Eq;
|
type BoundVarKind: Copy + Debug + Hash + Eq;
|
||||||
|
|
||||||
type CanonicalVars: Copy + Debug + Hash + Eq + IntoIterator<Item = CanonicalVarInfo<Self>>;
|
type CanonicalVars: Copy + Debug + Hash + Eq + IntoIterator<Item = ty::CanonicalVarInfo<Self>>;
|
||||||
type PredefinedOpaques: Copy + Debug + Hash + Eq;
|
type PredefinedOpaques: Copy + Debug + Hash + Eq;
|
||||||
type DefiningOpaqueTypes: Copy + Debug + Hash + Default + Eq + TypeVisitable<Self>;
|
type DefiningOpaqueTypes: Copy + Debug + Hash + Default + Eq + TypeVisitable<Self>;
|
||||||
type ExternalConstraints: Copy + Debug + Hash + Eq;
|
type ExternalConstraints: Copy + Debug + Hash + Eq;
|
||||||
@ -99,23 +95,23 @@ pub trait Interner:
|
|||||||
type Clause: Clause<Self>;
|
type Clause: Clause<Self>;
|
||||||
type Clauses: Copy + Debug + Hash + Eq + TypeSuperVisitable<Self> + Flags;
|
type Clauses: Copy + Debug + Hash + Eq + TypeSuperVisitable<Self> + Flags;
|
||||||
|
|
||||||
fn mk_canonical_var_infos(self, infos: &[CanonicalVarInfo<Self>]) -> Self::CanonicalVars;
|
fn mk_canonical_var_infos(self, infos: &[ty::CanonicalVarInfo<Self>]) -> Self::CanonicalVars;
|
||||||
|
|
||||||
type GenericsOf: GenericsOf<Self>;
|
type GenericsOf: GenericsOf<Self>;
|
||||||
fn generics_of(self, def_id: Self::DefId) -> Self::GenericsOf;
|
fn generics_of(self, def_id: Self::DefId) -> Self::GenericsOf;
|
||||||
|
|
||||||
// FIXME: Remove after uplifting `EarlyBinder`
|
// FIXME: Remove after uplifting `EarlyBinder`
|
||||||
fn type_of_instantiated(self, def_id: Self::DefId, args: Self::GenericArgs) -> Self::Ty;
|
fn type_of(self, def_id: Self::DefId) -> ty::EarlyBinder<Self, Self::Ty>;
|
||||||
|
|
||||||
fn alias_ty_kind(self, alias: AliasTy<Self>) -> AliasTyKind;
|
fn alias_ty_kind(self, alias: ty::AliasTy<Self>) -> ty::AliasTyKind;
|
||||||
|
|
||||||
fn alias_term_kind(self, alias: AliasTerm<Self>) -> AliasTermKind;
|
fn alias_term_kind(self, alias: ty::AliasTerm<Self>) -> ty::AliasTermKind;
|
||||||
|
|
||||||
fn trait_ref_and_own_args_for_alias(
|
fn trait_ref_and_own_args_for_alias(
|
||||||
self,
|
self,
|
||||||
def_id: Self::DefId,
|
def_id: Self::DefId,
|
||||||
args: Self::GenericArgs,
|
args: Self::GenericArgs,
|
||||||
) -> (TraitRef<Self>, Self::OwnItemArgs);
|
) -> (ty::TraitRef<Self>, Self::OwnItemArgs);
|
||||||
|
|
||||||
fn mk_args(self, args: &[Self::GenericArg]) -> Self::GenericArgs;
|
fn mk_args(self, args: &[Self::GenericArg]) -> Self::GenericArgs;
|
||||||
|
|
||||||
|
@ -567,7 +567,7 @@ impl<I: Interner> AliasTerm<I> {
|
|||||||
I::Const::new_unevaluated(
|
I::Const::new_unevaluated(
|
||||||
interner,
|
interner,
|
||||||
ty::UnevaluatedConst::new(self.def_id, self.args),
|
ty::UnevaluatedConst::new(self.def_id, self.args),
|
||||||
interner.type_of_instantiated(self.def_id, self.args),
|
interner.type_of(self.def_id).instantiate(interner, &self.args),
|
||||||
)
|
)
|
||||||
.into()
|
.into()
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user