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 {
|
self.obligations.push(Obligation {
|
||||||
cause: self.cause.clone(),
|
cause: self.cause.clone(),
|
||||||
param_env: self.param_env,
|
param_env: self.param_env,
|
||||||
predicate: ty::PredicateKind::RegionOutlives(ty::Binder::dummy(ty::OutlivesPredicate(
|
predicate: ty::PredicateKint::RegionOutlives(ty::OutlivesPredicate(sup, sub))
|
||||||
sup, sub,
|
.to_predicate(self.infcx.tcx),
|
||||||
)))
|
|
||||||
.to_predicate(self.infcx.tcx),
|
|
||||||
recursion_depth: 0,
|
recursion_depth: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -308,7 +308,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
|
||||||
self.obligations.push(Obligation::new(
|
self.obligations.push(Obligation::new(
|
||||||
self.trace.cause.clone(),
|
self.trace.cause.clone(),
|
||||||
self.param_env,
|
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>,
|
b: &'tcx ty::Const<'tcx>,
|
||||||
) {
|
) {
|
||||||
let predicate = if a_is_expected {
|
let predicate = if a_is_expected {
|
||||||
ty::PredicateKind::ConstEquate(a, b)
|
ty::PredicateKint::ConstEquate(a, b)
|
||||||
} else {
|
} else {
|
||||||
ty::PredicateKind::ConstEquate(b, a)
|
ty::PredicateKint::ConstEquate(b, a)
|
||||||
};
|
};
|
||||||
self.obligations.push(Obligation::new(
|
self.obligations.push(Obligation::new(
|
||||||
self.trace.cause.clone(),
|
self.trace.cause.clone(),
|
||||||
|
|
|
@ -100,11 +100,11 @@ impl TypeRelation<'tcx> for Sub<'combine, 'infcx, 'tcx> {
|
||||||
self.fields.obligations.push(Obligation::new(
|
self.fields.obligations.push(Obligation::new(
|
||||||
self.fields.trace.cause.clone(),
|
self.fields.trace.cause.clone(),
|
||||||
self.fields.param_env,
|
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_is_expected: self.a_is_expected,
|
||||||
a,
|
a,
|
||||||
b,
|
b,
|
||||||
}))
|
})
|
||||||
.to_predicate(self.tcx()),
|
.to_predicate(self.tcx()),
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -234,16 +234,16 @@ impl Elaborator<'tcx> {
|
||||||
if r.is_late_bound() {
|
if r.is_late_bound() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
Some(ty::PredicateKind::RegionOutlives(ty::Binder::dummy(
|
Some(ty::PredicateKint::RegionOutlives(ty::OutlivesPredicate(
|
||||||
ty::OutlivesPredicate(r, r_min),
|
r, r_min,
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Component::Param(p) => {
|
Component::Param(p) => {
|
||||||
let ty = tcx.mk_ty_param(p.index, p.name);
|
let ty = tcx.mk_ty_param(p.index, p.name);
|
||||||
Some(ty::PredicateKind::TypeOutlives(ty::Binder::dummy(
|
Some(ty::PredicateKint::TypeOutlives(ty::OutlivesPredicate(
|
||||||
ty::OutlivesPredicate(ty, r_min),
|
ty, r_min,
|
||||||
)))
|
)))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ impl<'tcx> EncodableWithShorthand for Ty<'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'tcx> EncodableWithShorthand for ty::Predicate<'tcx> {
|
impl<'tcx> EncodableWithShorthand for ty::Predicate<'tcx> {
|
||||||
type Variant = ty::PredicateKind<'tcx>;
|
type Variant = ty::PredicateKynd<'tcx>;
|
||||||
fn variant(&self) -> &Self::Variant {
|
fn variant(&self) -> &Self::Variant {
|
||||||
self.kind()
|
self.kind()
|
||||||
}
|
}
|
||||||
|
@ -195,7 +195,7 @@ where
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
let tcx = decoder.tcx();
|
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::fold::TypeFoldable;
|
||||||
use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef, UserSubsts};
|
use rustc_middle::ty::subst::{GenericArgKind, Subst, SubstsRef, UserSubsts};
|
||||||
use rustc_middle::ty::{
|
use rustc_middle::ty::{
|
||||||
self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPolyTraitRef,
|
self, CanonicalUserTypeAnnotation, CanonicalUserTypeAnnotations, RegionVid, ToPredicate, Ty,
|
||||||
ToPredicate, Ty, TyCtxt, UserType, UserTypeAnnotationIndex,
|
TyCtxt, UserType, UserTypeAnnotationIndex,
|
||||||
};
|
};
|
||||||
use rustc_span::{Span, DUMMY_SP};
|
use rustc_span::{Span, DUMMY_SP};
|
||||||
use rustc_target::abi::VariantIdx;
|
use rustc_target::abi::VariantIdx;
|
||||||
|
@ -1021,7 +1021,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.prove_predicate(
|
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),
|
Locations::All(span),
|
||||||
ConstraintCategory::TypeAnnotation,
|
ConstraintCategory::TypeAnnotation,
|
||||||
);
|
);
|
||||||
|
@ -1273,7 +1273,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
obligations.obligations.push(traits::Obligation::new(
|
obligations.obligations.push(traits::Obligation::new(
|
||||||
ObligationCause::dummy(),
|
ObligationCause::dummy(),
|
||||||
param_env,
|
param_env,
|
||||||
ty::PredicateKind::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
|
ty::PredicateKint::WellFormed(revealed_ty.into()).to_predicate(infcx.tcx),
|
||||||
));
|
));
|
||||||
obligations.add(
|
obligations.add(
|
||||||
infcx
|
infcx
|
||||||
|
@ -1617,7 +1617,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
self.check_call_dest(body, term, &sig, destination, term_location);
|
self.check_call_dest(body, term, &sig, destination, term_location);
|
||||||
|
|
||||||
self.prove_predicates(
|
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(),
|
term_location.to_locations(),
|
||||||
ConstraintCategory::Boring,
|
ConstraintCategory::Boring,
|
||||||
);
|
);
|
||||||
|
@ -2706,8 +2706,8 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||||
category: ConstraintCategory,
|
category: ConstraintCategory,
|
||||||
) {
|
) {
|
||||||
self.prove_predicates(
|
self.prove_predicates(
|
||||||
Some(ty::PredicateKind::Trait(
|
Some(ty::PredicateKint::Trait(
|
||||||
trait_ref.to_poly_trait_ref().to_poly_trait_predicate(),
|
ty::TraitPredicate { trait_ref },
|
||||||
hir::Constness::NotConst,
|
hir::Constness::NotConst,
|
||||||
)),
|
)),
|
||||||
locations,
|
locations,
|
||||||
|
|
|
@ -532,7 +532,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
||||||
obligations.push(Obligation::new(
|
obligations.push(Obligation::new(
|
||||||
obligation.cause.clone(),
|
obligation.cause.clone(),
|
||||||
obligation.param_env,
|
obligation.param_env,
|
||||||
ty::PredicateKind::ClosureKind(closure_def_id, substs, kind)
|
ty::PredicateKint::ClosureKind(closure_def_id, substs, kind)
|
||||||
.to_predicate(self.tcx()),
|
.to_predicate(self.tcx()),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
|
@ -316,7 +316,7 @@ impl<'a, 'tcx> WfPredicates<'a, 'tcx> {
|
||||||
traits::Obligation::new(
|
traits::Obligation::new(
|
||||||
new_cause,
|
new_cause,
|
||||||
param_env,
|
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.relate(self_ty, Variance::Invariant, impl_self_ty)?;
|
||||||
|
|
||||||
self.prove_predicate(
|
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
|
// them? This would only be relevant if some input
|
||||||
// type were ill-formed but did not appear in `ty`,
|
// type were ill-formed but did not appear in `ty`,
|
||||||
// which...could happen with normalization...
|
// 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(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -399,7 +399,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
obligations.push(traits::Obligation::new(
|
obligations.push(traits::Obligation::new(
|
||||||
cause,
|
cause,
|
||||||
self.param_env,
|
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 };
|
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(
|
self.register_predicate(traits::Obligation::new(
|
||||||
cause,
|
cause,
|
||||||
self.param_env,
|
self.param_env,
|
||||||
ty::PredicateKind::WellFormed(arg).to_predicate(self.tcx),
|
ty::PredicateKint::WellFormed(arg).to_predicate(self.tcx),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue