Inline and remove SelectionContext::fast_reject_trait_refs
.
Because it has a single call site, and it lets us move a small amount of the work outside the loop.
This commit is contained in:
parent
9fa69473fd
commit
03923661af
2 changed files with 4 additions and 18 deletions
|
@ -45,7 +45,6 @@ use rustc_infer::traits::TraitEngineExt;
|
|||
use rustc_middle::dep_graph::{DepKind, DepNodeIndex};
|
||||
use rustc_middle::mir::interpret::ErrorHandled;
|
||||
use rustc_middle::ty::abstract_const::NotConstEvaluatable;
|
||||
use rustc_middle::ty::fast_reject::{DeepRejectCtxt, TreatParams};
|
||||
use rustc_middle::ty::fold::BottomUpFolder;
|
||||
use rustc_middle::ty::relate::TypeRelation;
|
||||
use rustc_middle::ty::SubstsRef;
|
||||
|
@ -2533,21 +2532,6 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
|||
Ok(Normalized { value: impl_substs, obligations: nested_obligations })
|
||||
}
|
||||
|
||||
fn fast_reject_trait_refs(
|
||||
&mut self,
|
||||
obligation: &TraitObligation<'tcx>,
|
||||
impl_trait_ref: &ty::TraitRef<'tcx>,
|
||||
) -> bool {
|
||||
// We can avoid creating type variables and doing the full
|
||||
// substitution if we find that any of the input types, when
|
||||
// simplified, do not match.
|
||||
let drcx = DeepRejectCtxt { treat_obligation_params: TreatParams::ForLookup };
|
||||
!drcx.substs_refs_may_unify(
|
||||
obligation.predicate.skip_binder().trait_ref.substs,
|
||||
impl_trait_ref.substs,
|
||||
)
|
||||
}
|
||||
|
||||
/// Normalize `where_clause_trait_ref` and try to match it against
|
||||
/// `obligation`. If successful, return any predicates that
|
||||
/// result from the normalization.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue