Use DeepRejectCtxt
to quickly reject ParamEnv
candidates
This commit is contained in:
parent
717aec0f8e
commit
c51953f4d8
16 changed files with 287 additions and 167 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
use rustc_ast_ir::Movability;
|
||||
use rustc_type_ir::data_structures::IndexSet;
|
||||
use rustc_type_ir::fast_reject::{DeepRejectCtxt, TreatParams};
|
||||
use rustc_type_ir::fast_reject::DeepRejectCtxt;
|
||||
use rustc_type_ir::inherent::*;
|
||||
use rustc_type_ir::lang_items::TraitSolverLangItem;
|
||||
use rustc_type_ir::visit::TypeVisitableExt as _;
|
||||
|
@ -47,7 +47,7 @@ where
|
|||
let cx = ecx.cx();
|
||||
|
||||
let impl_trait_ref = cx.impl_trait_ref(impl_def_id);
|
||||
if !DeepRejectCtxt::new(ecx.cx(), TreatParams::ForLookup)
|
||||
if !DeepRejectCtxt::relate_rigid_infer(ecx.cx())
|
||||
.args_may_unify(goal.predicate.trait_ref.args, impl_trait_ref.skip_binder().args)
|
||||
{
|
||||
return Err(NoSolution);
|
||||
|
@ -124,6 +124,13 @@ where
|
|||
if trait_clause.def_id() == goal.predicate.def_id()
|
||||
&& trait_clause.polarity() == goal.predicate.polarity
|
||||
{
|
||||
if !DeepRejectCtxt::relate_rigid_rigid(ecx.cx()).args_may_unify(
|
||||
goal.predicate.trait_ref.args,
|
||||
trait_clause.skip_binder().trait_ref.args,
|
||||
) {
|
||||
return Err(NoSolution);
|
||||
}
|
||||
|
||||
ecx.probe_trait_candidate(source).enter(|ecx| {
|
||||
let assumption_trait_pred = ecx.instantiate_binder_with_infer(trait_clause);
|
||||
ecx.eq(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue