1
Fork 0

Auto merge of #113308 - compiler-errors:poly-select, r=lcnr

Split `SelectionContext::select` into fns that take a binder and don't

*most* usages of `SelectionContext::select` don't need to use a binder, but wrap them in a dummy because of the signature. Let's split this out into `SelectionContext::{select,poly_select}` and limit the usages of the latter.

Right now, we only have 3 places where we're calling `poly_select` -- fulfillment, internally within the old solver, and the auto-trait finder.

r? `@lcnr`
This commit is contained in:
bors 2023-07-07 10:32:42 +00:00
commit 1a449dcfd2
21 changed files with 125 additions and 112 deletions

View file

@ -62,7 +62,8 @@ impl<'tcx, P> From<Obligation<'tcx, P>> for solve::Goal<'tcx, P> {
}
pub type PredicateObligation<'tcx> = Obligation<'tcx, ty::Predicate<'tcx>>;
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
pub type TraitObligation<'tcx> = Obligation<'tcx, ty::TraitPredicate<'tcx>>;
pub type PolyTraitObligation<'tcx> = Obligation<'tcx, ty::PolyTraitPredicate<'tcx>>;
impl<'tcx> PredicateObligation<'tcx> {
/// Flips the polarity of the inner predicate.
@ -86,7 +87,7 @@ impl<'tcx> PredicateObligation<'tcx> {
}
}
impl<'tcx> TraitObligation<'tcx> {
impl<'tcx> PolyTraitObligation<'tcx> {
/// Returns `true` if the trait predicate is considered `const` in its ParamEnv.
pub fn is_const(&self) -> bool {
matches!(
@ -193,7 +194,7 @@ impl<'tcx> FulfillmentError<'tcx> {
}
}
impl<'tcx> TraitObligation<'tcx> {
impl<'tcx> PolyTraitObligation<'tcx> {
pub fn polarity(&self) -> ty::ImplPolarity {
self.predicate.skip_binder().polarity
}