Use DeepRejectCtxt to quickly reject ParamEnv candidates
This commit is contained in:
@@ -13,6 +13,7 @@ use rustc_infer::traits::ObligationCauseCode;
|
||||
use rustc_middle::traits::select::OverflowError;
|
||||
pub use rustc_middle::traits::Reveal;
|
||||
use rustc_middle::traits::{BuiltinImplSource, ImplSource, ImplSourceUserDefinedData};
|
||||
use rustc_middle::ty::fast_reject::DeepRejectCtxt;
|
||||
use rustc_middle::ty::fold::TypeFoldable;
|
||||
use rustc_middle::ty::visit::{MaxUniverse, TypeVisitable, TypeVisitableExt};
|
||||
use rustc_middle::ty::{self, Term, Ty, TyCtxt, Upcast};
|
||||
@@ -885,6 +886,7 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>(
|
||||
potentially_unnormalized_candidates: bool,
|
||||
) {
|
||||
let infcx = selcx.infcx;
|
||||
let drcx = DeepRejectCtxt::relate_rigid_rigid(selcx.tcx());
|
||||
for predicate in env_predicates {
|
||||
let bound_predicate = predicate.kind();
|
||||
if let ty::ClauseKind::Projection(data) = predicate.kind().skip_binder() {
|
||||
@@ -893,6 +895,12 @@ fn assemble_candidates_from_predicates<'cx, 'tcx>(
|
||||
continue;
|
||||
}
|
||||
|
||||
if !drcx
|
||||
.args_may_unify(obligation.predicate.args, data.skip_binder().projection_term.args)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
let is_match = infcx.probe(|_| {
|
||||
selcx.match_projection_projections(
|
||||
obligation,
|
||||
|
||||
Reference in New Issue
Block a user