Use DeepRejectCtxt to quickly reject ParamEnv candidates
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;
|
||||
@@ -316,7 +316,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;
|
||||
@@ -337,7 +337,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;
|
||||
@@ -357,7 +357,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