Remove PredicateKind

This commit is contained in:
Jack Huey
2020-12-23 16:36:23 -05:00
parent 4cb3d6f983
commit 4cd6f85a07
12 changed files with 38 additions and 68 deletions

View File

@@ -17,9 +17,9 @@ use crate::ty::query::{self, TyCtxtAt};
use crate::ty::subst::{GenericArg, GenericArgKind, InternalSubsts, Subst, SubstsRef, UserSubsts};
use crate::ty::TyKind::*;
use crate::ty::{
self, AdtDef, AdtKind, BindingMode, BoundVar, CanonicalPolyFnSig, Const, ConstVid, DefIdTree,
ExistentialPredicate, FloatVar, FloatVid, GenericParamDefKind, InferConst, InferTy, IntVar,
IntVid, List, ParamConst, ParamTy, PolyFnSig, Predicate, PredicateInner, PredicateKind,
self, AdtDef, AdtKind, Binder, BindingMode, BoundVar, CanonicalPolyFnSig, Const, ConstVid,
DefIdTree, ExistentialPredicate, FloatVar, FloatVid, GenericParamDefKind, InferConst, InferTy,
IntVar, IntVid, List, ParamConst, ParamTy, PolyFnSig, Predicate, PredicateAtom, PredicateInner,
ProjectionTy, Region, RegionKind, ReprOptions, TraitObjectVisitor, Ty, TyKind, TyS, TyVar,
TyVid, TypeAndMut, Visibility,
};
@@ -133,7 +133,7 @@ impl<'tcx> CtxtInterners<'tcx> {
}
#[inline(never)]
fn intern_predicate(&self, kind: PredicateKind<'tcx>) -> &'tcx PredicateInner<'tcx> {
fn intern_predicate(&self, kind: Binder<PredicateAtom<'tcx>>) -> &'tcx PredicateInner<'tcx> {
self.predicate
.intern(kind, |kind| {
let flags = super::flags::FlagComputation::for_predicate(kind);
@@ -1948,8 +1948,8 @@ impl<'tcx> Hash for Interned<'tcx, PredicateInner<'tcx>> {
}
}
impl<'tcx> Borrow<PredicateKind<'tcx>> for Interned<'tcx, PredicateInner<'tcx>> {
fn borrow<'a>(&'a self) -> &'a PredicateKind<'tcx> {
impl<'tcx> Borrow<Binder<PredicateAtom<'tcx>>> for Interned<'tcx, PredicateInner<'tcx>> {
fn borrow<'a>(&'a self) -> &'a Binder<PredicateAtom<'tcx>> {
&self.0.kind
}
}
@@ -1987,12 +1987,6 @@ impl<'tcx> Borrow<Const<'tcx>> for Interned<'tcx, Const<'tcx>> {
}
}
impl<'tcx> Borrow<PredicateKind<'tcx>> for Interned<'tcx, PredicateKind<'tcx>> {
fn borrow<'a>(&'a self) -> &'a PredicateKind<'tcx> {
&self.0
}
}
macro_rules! direct_interners {
($($name:ident: $method:ident($ty:ty),)+) => {
$(impl<'tcx> PartialEq for Interned<'tcx, $ty> {
@@ -2091,7 +2085,7 @@ impl<'tcx> TyCtxt<'tcx> {
}
#[inline]
pub fn mk_predicate(self, kind: PredicateKind<'tcx>) -> Predicate<'tcx> {
pub fn mk_predicate(self, kind: Binder<PredicateAtom<'tcx>>) -> Predicate<'tcx> {
let inner = self.interners.intern_predicate(kind);
Predicate { inner }
}
@@ -2100,9 +2094,9 @@ impl<'tcx> TyCtxt<'tcx> {
pub fn reuse_or_mk_predicate(
self,
pred: Predicate<'tcx>,
kind: PredicateKind<'tcx>,
kind: Binder<PredicateAtom<'tcx>>,
) -> Predicate<'tcx> {
if *pred.kind() != kind { self.mk_predicate(kind) } else { pred }
if pred.kind() != kind { self.mk_predicate(kind) } else { pred }
}
pub fn mk_mach_int(self, tm: ast::IntTy) -> Ty<'tcx> {