Rollup merge of #91920 - Aaron1011:pred-stable-cmp, r=oli-obk

Use `tcx.def_path_hash` in `ExistentialPredicate.stable_cmp`

This avoids a needless query invocation
This commit is contained in:
Matthias Krüger 2021-12-15 10:57:04 +01:00 committed by GitHub
commit 990cf5bca4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -787,7 +787,7 @@ impl<'tcx> ExistentialPredicate<'tcx> {
tcx.def_path_hash(a.item_def_id).cmp(&tcx.def_path_hash(b.item_def_id)) tcx.def_path_hash(a.item_def_id).cmp(&tcx.def_path_hash(b.item_def_id))
} }
(AutoTrait(ref a), AutoTrait(ref b)) => { (AutoTrait(ref a), AutoTrait(ref b)) => {
tcx.trait_def(*a).def_path_hash.cmp(&tcx.trait_def(*b).def_path_hash) tcx.def_path_hash(*a).cmp(&tcx.def_path_hash(*b))
} }
(Trait(_), _) => Ordering::Less, (Trait(_), _) => Ordering::Less,
(Projection(_), Trait(_)) => Ordering::Greater, (Projection(_), Trait(_)) => Ordering::Greater,