Stop passing traitref/traitpredicate by ref
This commit is contained in:
@@ -1866,7 +1866,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
// the param_env so that it can be given the lowest priority. See
|
||||
// #50825 for the motivation for this.
|
||||
let is_global =
|
||||
|cand: &ty::PolyTraitPredicate<'tcx>| cand.is_global() && !cand.has_bound_vars();
|
||||
|cand: ty::PolyTraitPredicate<'tcx>| cand.is_global() && !cand.has_bound_vars();
|
||||
|
||||
// (*) Prefer `BuiltinCandidate { has_nested: false }`, `PointeeCandidate`,
|
||||
// `DiscriminantKindCandidate`, `ConstDestructCandidate`
|
||||
@@ -1909,7 +1909,7 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
}
|
||||
|
||||
(
|
||||
ParamCandidate(ref other_cand),
|
||||
ParamCandidate(other_cand),
|
||||
ImplCandidate(..)
|
||||
| AutoImplCandidate
|
||||
| ClosureCandidate { .. }
|
||||
@@ -1934,12 +1934,12 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
//
|
||||
// Global bounds from the where clause should be ignored
|
||||
// here (see issue #50825).
|
||||
DropVictim::drop_if(!is_global(other_cand))
|
||||
DropVictim::drop_if(!is_global(*other_cand))
|
||||
}
|
||||
(ObjectCandidate(_) | ProjectionCandidate(_), ParamCandidate(ref victim_cand)) => {
|
||||
(ObjectCandidate(_) | ProjectionCandidate(_), ParamCandidate(victim_cand)) => {
|
||||
// Prefer these to a global where-clause bound
|
||||
// (see issue #50825).
|
||||
if is_global(victim_cand) { DropVictim::Yes } else { DropVictim::No }
|
||||
if is_global(*victim_cand) { DropVictim::Yes } else { DropVictim::No }
|
||||
}
|
||||
(
|
||||
ImplCandidate(_)
|
||||
@@ -1957,12 +1957,12 @@ impl<'tcx> SelectionContext<'_, 'tcx> {
|
||||
| TraitUpcastingUnsizeCandidate(_)
|
||||
| BuiltinCandidate { has_nested: true }
|
||||
| TraitAliasCandidate,
|
||||
ParamCandidate(ref victim_cand),
|
||||
ParamCandidate(victim_cand),
|
||||
) => {
|
||||
// Prefer these to a global where-clause bound
|
||||
// (see issue #50825).
|
||||
DropVictim::drop_if(
|
||||
is_global(victim_cand) && other.evaluation.must_apply_modulo_regions(),
|
||||
is_global(*victim_cand) && other.evaluation.must_apply_modulo_regions(),
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user