Rollup merge of #127146 - compiler-errors:fast-reject, r=lcnr

Uplift fast rejection to new solver

Self explanatory.

r? lcnr
This commit is contained in:
Matthias Krüger 2024-07-02 17:47:47 +02:00 committed by GitHub
commit 36da46ab98
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 419 additions and 402 deletions

View file

@ -3,6 +3,7 @@ mod inherent;
mod opaque_types;
mod weak_types;
use rustc_type_ir::fast_reject::{DeepRejectCtxt, TreatParams};
use rustc_type_ir::inherent::*;
use rustc_type_ir::lang_items::TraitSolverLangItem;
use rustc_type_ir::Upcast as _;
@ -144,7 +145,7 @@ where
let goal_trait_ref = goal.predicate.alias.trait_ref(cx);
let impl_trait_ref = cx.impl_trait_ref(impl_def_id);
if !ecx.cx().args_may_unify_deep(
if !DeepRejectCtxt::new(ecx.cx(), TreatParams::ForLookup).args_may_unify(
goal.predicate.alias.trait_ref(cx).args,
impl_trait_ref.skip_binder().args,
) {

View file

@ -2,6 +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::inherent::*;
use rustc_type_ir::lang_items::TraitSolverLangItem;
use rustc_type_ir::visit::TypeVisitableExt as _;
@ -46,7 +47,8 @@ where
let cx = ecx.cx();
let impl_trait_ref = cx.impl_trait_ref(impl_def_id);
if !cx.args_may_unify_deep(goal.predicate.trait_ref.args, impl_trait_ref.skip_binder().args)
if !DeepRejectCtxt::new(ecx.cx(), TreatParams::ForLookup)
.args_may_unify(goal.predicate.trait_ref.args, impl_trait_ref.skip_binder().args)
{
return Err(NoSolution);
}