SIGN IN SIGN UP

Avoid another duplicate `goal.predicate.alias.trait_ref(cx)`

It's expensive and is called unconditionally in
`NormalizesTo::consider_impl_candidate`, which is always called within a
loop. The result is invariant across the loop, so this commit hoists the
call outside of `consider_impl_candidate` and passes the return value in.

Notes:

- At the hoist sites, the expression is `goal.predicate.trait_ref(cx)`;
  for `NormalizesTo` this dispatches to
  `goal.predicate.alias.trait_ref(cx)`.

- Two other `GoalKind` methods are affected, but this doesn't
  change perf because they can get the `goal_trait_ref` cheaply.
N
Nicholas Nethercote committed
3cf1de3004d1bca8c4913690939a31fa265eae2f
Parent: 6c28fdd