convert trivial predicates
This commit is contained in:
parent
fb36c8bc80
commit
c1d244ffd8
11 changed files with 26 additions and 28 deletions
|
@ -670,10 +670,8 @@ impl<'tcx> TypeRelatingDelegate<'tcx> for QueryTypeRelatingDelegate<'_, 'tcx> {
|
|||
self.obligations.push(Obligation {
|
||||
cause: self.cause.clone(),
|
||||
param_env: self.param_env,
|
||||
predicate: ty::PredicateKind::RegionOutlives(ty::Binder::dummy(ty::OutlivesPredicate(
|
||||
sup, sub,
|
||||
)))
|
||||
.to_predicate(self.infcx.tcx),
|
||||
predicate: ty::PredicateKint::RegionOutlives(ty::OutlivesPredicate(sup, sub))
|
||||
.to_predicate(self.infcx.tcx),
|
||||
recursion_depth: 0,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -308,7 +308,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
|||
self.obligations.push(Obligation::new(
|
||||
self.trace.cause.clone(),
|
||||
self.param_env,
|
||||
ty::PredicateKind::WellFormed(b_ty.into()).to_predicate(self.infcx.tcx),
|
||||
ty::PredicateKint::WellFormed(b_ty.into()).to_predicate(self.infcx.tcx),
|
||||
));
|
||||
}
|
||||
|
||||
|
@ -400,9 +400,9 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
|||
b: &'tcx ty::Const<'tcx>,
|
||||
) {
|
||||
let predicate = if a_is_expected {
|
||||
ty::PredicateKind::ConstEquate(a, b)
|
||||
ty::PredicateKint::ConstEquate(a, b)
|
||||
} else {
|
||||
ty::PredicateKind::ConstEquate(b, a)
|
||||
ty::PredicateKint::ConstEquate(b, a)
|
||||
};
|
||||
self.obligations.push(Obligation::new(
|
||||
self.trace.cause.clone(),
|
||||
|
|
|
@ -100,11 +100,11 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
|
|||
self.fields.obligations.push(Obligation::new(
|
||||
self.fields.trace.cause.clone(),
|
||||
self.fields.param_env,
|
||||
ty::PredicateKind::Subtype(ty::Binder::dummy(ty::SubtypePredicate {
|
||||
ty::PredicateKint::Subtype(ty::SubtypePredicate {
|
||||
a_is_expected: self.a_is_expected,
|
||||
a,
|
||||
b,
|
||||
}))
|
||||
})
|
||||
.to_predicate(self.tcx()),
|
||||
));
|
||||
|
||||
|
|
|
@ -234,16 +234,16 @@ impl Elaborator<'tcx> {
|
|||
if r.is_late_bound() {
|
||||
None
|
||||
} else {
|
||||
Some(ty::PredicateKind::RegionOutlives(ty::Binder::dummy(
|
||||
ty::OutlivesPredicate(r, r_min),
|
||||
Some(ty::PredicateKint::RegionOutlives(ty::OutlivesPredicate(
|
||||
r, r_min,
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
Component::Param(p) => {
|
||||
let ty = tcx.mk_ty_param(p.index, p.name);
|
||||
Some(ty::PredicateKind::TypeOutlives(ty::Binder::dummy(
|
||||
ty::OutlivesPredicate(ty, r_min),
|
||||
Some(ty::PredicateKint::TypeOutlives(ty::OutlivesPredicate(
|
||||
ty, r_min,
|
||||
)))
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ impl<'tcx> EncodableWithShorthand for Ty<'tcx> {
|
|||
}
|
||||
|
||||
impl<'tcx> EncodableWithShorthand for ty::Predicate<'tcx> {
|
||||
type Variant = ty::PredicateKind<'tcx>;
|
||||
type Variant = ty::PredicateKynd<'tcx>;
|
||||
fn variant(&self) -> &Self::Variant {
|
||||
self.kind()
|
||||
}
|
||||
|
@ -195,7 +195,7 @@ where
|
|||
})
|
||||
} else {
|
||||
let tcx = decoder.tcx();
|
||||
Ok(tcx.mk_predicate(ty::PredicateKind::decode(decoder)?))
|
||||
Ok(tcx.mk_predicate(ty::PredicateKynd::decode(decoder)?))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,8 +27,8 @@ use rustc_middle::ty::cast::CastTy;
|
|||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef, UserSubsts};
|
||||
use rustc_middle::ty::{
|
||||
self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPolyTraitRef,
|
||||
ToPredicate, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,
|
||||
self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPredicate, Ty,
|
||||
TyCtxt, UserType, UserTypeAnnotationIndex,
|
||||
};
|
||||
use rustc_span::{Span, DUMMY_SP};
|
||||
use rustc_target::abi::VariantIdx;
|
||||
|
@ -1021,7 +1021,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
}
|
||||
|
||||
self.prove_predicate(
|
||||
ty::PredicateKind::WellFormed(inferred_ty.into()).to_predicate(self.tcx()),
|
||||
ty::PredicateKint::WellFormed(inferred_ty.into()).to_predicate(self.tcx()),
|
||||
Locations::All(span),
|
||||
ConstraintCategory::TypeAnnotation,
|
||||
);
|
||||
|
@ -1273,7 +1273,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
obligations.obligations.push(traits::Obligation::new(
|
||||
ObligationCause::dummy(),
|
||||
param_env,
|
||||
ty::PredicateKind::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
|
||||
ty::PredicateKint::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
|
||||
));
|
||||
obligations.add(
|
||||
infcx
|
||||
|
@ -1617,7 +1617,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
self.check_call_dest(body, term, &sig, destination, term_location);
|
||||
|
||||
self.prove_predicates(
|
||||
sig.inputs_and_output.iter().map(|ty| ty::PredicateKind::WellFormed(ty.into())),
|
||||
sig.inputs_and_output.iter().map(|ty| ty::PredicateKint::WellFormed(ty.into())),
|
||||
term_location.to_locations(),
|
||||
ConstraintCategory::Boring,
|
||||
);
|
||||
|
@ -2706,8 +2706,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
|||
category: ConstraintCategory,
|
||||
) {
|
||||
self.prove_predicates(
|
||||
Some(ty::PredicateKind::Trait(
|
||||
trait_ref.to_poly_trait_ref().to_poly_trait_predicate(),
|
||||
Some(ty::PredicateKint::Trait(
|
||||
ty::TraitPredicate { trait_ref },
|
||||
hir::Constness::NotConst,
|
||||
)),
|
||||
locations,
|
||||
|
|
|
@ -532,7 +532,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
obligations.push(Obligation::new(
|
||||
obligation.cause.clone(),
|
||||
obligation.param_env,
|
||||
ty::PredicateKind::ClosureKind(closure_def_id, substs, kind)
|
||||
ty::PredicateKint::ClosureKind(closure_def_id, substs, kind)
|
||||
.to_predicate(self.tcx()),
|
||||
));
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
|||
traits::Obligation::new(
|
||||
new_cause,
|
||||
param_env,
|
||||
ty::PredicateKind::WellFormed(arg).to_predicate(tcx),
|
||||
ty::PredicateKint::WellFormed(arg).to_predicate(tcx),
|
||||
)
|
||||
}),
|
||||
);
|
||||
|
|
|
@ -140,7 +140,7 @@ impl AscribeUserTypeCx<'me, 'tcx> {
|
|||
self.relate(self_ty, Variance::Invariant, impl_self_ty)?;
|
||||
|
||||
self.prove_predicate(
|
||||
ty::PredicateKind::WellFormed(impl_self_ty.into()).to_predicate(self.tcx()),
|
||||
ty::PredicateKint::WellFormed(impl_self_ty.into()).to_predicate(self.tcx()),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -155,7 +155,7 @@ impl AscribeUserTypeCx<'me, 'tcx> {
|
|||
// them? This would only be relevant if some input
|
||||
// type were ill-formed but did not appear in `ty`,
|
||||
// which...could happen with normalization...
|
||||
self.prove_predicate(ty::PredicateKind::WellFormed(ty.into()).to_predicate(self.tcx()));
|
||||
self.prove_predicate(ty::PredicateKint::WellFormed(ty.into()).to_predicate(self.tcx()));
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -399,7 +399,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
obligations.push(traits::Obligation::new(
|
||||
cause,
|
||||
self.param_env,
|
||||
ty::PredicateKind::WellFormed(method_ty.into()).to_predicate(tcx),
|
||||
ty::PredicateKint::WellFormed(method_ty.into()).to_predicate(tcx),
|
||||
));
|
||||
|
||||
let callee = MethodCallee { def_id, substs: trait_ref.substs, sig: fn_sig };
|
||||
|
|
|
@ -3612,7 +3612,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
|||
self.register_predicate(traits::Obligation::new(
|
||||
cause,
|
||||
self.param_env,
|
||||
ty::PredicateKind::WellFormed(arg).to_predicate(self.tcx),
|
||||
ty::PredicateKint::WellFormed(arg).to_predicate(self.tcx),
|
||||
));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue