traits::select: quickly filter out predicates from other traits
this improves most pre-trans passes's performance by ~1%.
This commit is contained in:
parent
23de823e93
commit
eadb049799
1 changed files with 6 additions and 1 deletions
|
@ -1300,8 +1300,13 @@ impl<'cx, 'gcx, 'tcx> SelectionContext<'cx, 'gcx, 'tcx> {
|
||||||
.iter()
|
.iter()
|
||||||
.filter_map(|o| o.to_opt_poly_trait_ref());
|
.filter_map(|o| o.to_opt_poly_trait_ref());
|
||||||
|
|
||||||
|
// micro-optimization: filter out predicates relating to different
|
||||||
|
// traits.
|
||||||
let matching_bounds =
|
let matching_bounds =
|
||||||
all_bounds.filter(
|
all_bounds.filter(|p| p.def_id() == stack.obligation.predicate.def_id());
|
||||||
|
|
||||||
|
let matching_bounds =
|
||||||
|
matching_bounds.filter(
|
||||||
|bound| self.evaluate_where_clause(stack, bound.clone()).may_apply());
|
|bound| self.evaluate_where_clause(stack, bound.clone()).may_apply());
|
||||||
|
|
||||||
let param_candidates =
|
let param_candidates =
|
||||||
|
|
Loading…
Reference in a new issue