Auto merge of #128776 - Bryanskiy:deep-reject-ctxt, r=lcnr
Use `DeepRejectCtxt` to quickly reject `ParamEnv` candidates The description is on the [zulip thread](https://rust-lang.zulipchat.com/#narrow/stream/144729-t-types/topic/.5Basking.20for.20help.5D.20.60DeepRejectCtxt.60.20for.20param.20env.20candidates) r? `@lcnr`
This commit is contained in:
@@ -4,7 +4,7 @@ use rustc_hir as hir;
|
||||
use rustc_hir::def::DefKind;
|
||||
use rustc_middle::traits::{ObligationCause, ObligationCauseCode};
|
||||
use rustc_middle::ty::error::{ExpectedFound, TypeError};
|
||||
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
|
||||
use rustc_middle::ty::fast_reject::DeepRejectCtxt;
|
||||
use rustc_middle::ty::print::{FmtPrinter, Printer};
|
||||
use rustc_middle::ty::{self, suggest_constraining_type_param, Ty};
|
||||
use rustc_span::def_id::DefId;
|
||||
@@ -317,7 +317,7 @@ impl<T> Trait<T> for X {
|
||||
{
|
||||
let mut has_matching_impl = false;
|
||||
tcx.for_each_relevant_impl(def_id, values.found, |did| {
|
||||
if DeepRejectCtxt::new(tcx, TreatParams::ForLookup)
|
||||
if DeepRejectCtxt::relate_rigid_infer(tcx)
|
||||
.types_may_unify(values.found, tcx.type_of(did).skip_binder())
|
||||
{
|
||||
has_matching_impl = true;
|
||||
@@ -338,7 +338,7 @@ impl<T> Trait<T> for X {
|
||||
{
|
||||
let mut has_matching_impl = false;
|
||||
tcx.for_each_relevant_impl(def_id, values.expected, |did| {
|
||||
if DeepRejectCtxt::new(tcx, TreatParams::ForLookup)
|
||||
if DeepRejectCtxt::relate_rigid_infer(tcx)
|
||||
.types_may_unify(values.expected, tcx.type_of(did).skip_binder())
|
||||
{
|
||||
has_matching_impl = true;
|
||||
@@ -358,7 +358,7 @@ impl<T> Trait<T> for X {
|
||||
{
|
||||
let mut has_matching_impl = false;
|
||||
tcx.for_each_relevant_impl(def_id, values.found, |did| {
|
||||
if DeepRejectCtxt::new(tcx, TreatParams::ForLookup)
|
||||
if DeepRejectCtxt::relate_rigid_infer(tcx)
|
||||
.types_may_unify(values.found, tcx.type_of(did).skip_binder())
|
||||
{
|
||||
has_matching_impl = true;
|
||||
|
||||
Reference in New Issue
Block a user