Revert "Auto merge of #91491 - spastorino:revert-91354, r=oli-obk"
This reverts commitff2439b7b9
, reversing changes made to2a9e0831d6
.
This commit is contained in:
parent
c5f8788d8d
commit
84b1d859c8
49 changed files with 400 additions and 424 deletions
|
@ -13,7 +13,7 @@ use rustc_infer::infer::InferOk;
|
|||
use rustc_infer::infer::LateBoundRegionConversionTime::HigherRankedType;
|
||||
use rustc_middle::ty::subst::{GenericArg, GenericArgKind, Subst, SubstsRef};
|
||||
use rustc_middle::ty::{self, Ty};
|
||||
use rustc_middle::ty::{ToPolyTraitRef, ToPredicate, WithConstness};
|
||||
use rustc_middle::ty::{ToPolyTraitRef, ToPredicate};
|
||||
use rustc_span::def_id::DefId;
|
||||
|
||||
use crate::traits::project::{normalize_with_depth, normalize_with_depth_to};
|
||||
|
@ -58,8 +58,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
}
|
||||
|
||||
ParamCandidate(param) => {
|
||||
let obligations = self.confirm_param_candidate(obligation, param.0.value);
|
||||
Ok(ImplSource::Param(obligations, param.0.constness))
|
||||
let obligations =
|
||||
self.confirm_param_candidate(obligation, param.map_bound(|t| t.trait_ref));
|
||||
Ok(ImplSource::Param(obligations, param.skip_binder().constness))
|
||||
}
|
||||
|
||||
ImplCandidate(impl_def_id) => {
|
||||
|
@ -139,7 +140,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let trait_predicate = self.infcx.shallow_resolve(obligation.predicate);
|
||||
let placeholder_trait_predicate =
|
||||
self.infcx().replace_bound_vars_with_placeholders(trait_predicate);
|
||||
self.infcx().replace_bound_vars_with_placeholders(trait_predicate).trait_ref;
|
||||
let placeholder_self_ty = placeholder_trait_predicate.self_ty();
|
||||
let placeholder_trait_predicate = ty::Binder::dummy(placeholder_trait_predicate);
|
||||
let (def_id, substs) = match *placeholder_self_ty.kind() {
|
||||
|
@ -150,8 +151,9 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
|
||||
let candidate_predicate = tcx.item_bounds(def_id)[idx].subst(tcx, substs);
|
||||
let candidate = candidate_predicate
|
||||
.to_opt_poly_trait_ref()
|
||||
.expect("projection candidate is not a trait predicate");
|
||||
.to_opt_poly_trait_pred()
|
||||
.expect("projection candidate is not a trait predicate")
|
||||
.map_bound(|t| t.trait_ref);
|
||||
let mut obligations = Vec::new();
|
||||
let candidate = normalize_with_depth_to(
|
||||
self,
|
||||
|
@ -165,7 +167,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
|
|||
obligations.extend(self.infcx.commit_if_ok(|_| {
|
||||
self.infcx
|
||||
.at(&obligation.cause, obligation.param_env)
|
||||
.sup(placeholder_trait_predicate.to_poly_trait_ref(), candidate.value)
|
||||
.sup(placeholder_trait_predicate, candidate)
|
||||
.map(|InferOk { obligations, .. }| obligations)
|
||||
.map_err(|_| Unimplemented)
|
||||
})?);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue