Auto merge of #119048 - aliemjay:perf-register-pred, r=compiler-errors

don't fold ParamEnv in register_predicate_obligation

\>5% perf gain for diesel!
This commit is contained in:
bors 2023-12-17 18:27:09 +00:00
commit 4283aeaca5

View File

@ -116,12 +116,13 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
fn register_predicate_obligation(
&mut self,
infcx: &InferCtxt<'tcx>,
obligation: PredicateObligation<'tcx>,
mut obligation: PredicateObligation<'tcx>,
) {
assert_eq!(self.usable_in_snapshot, infcx.num_open_snapshots());
// this helps to reduce duplicate errors, as well as making
// debug output much nicer to read and so on.
let obligation = infcx.resolve_vars_if_possible(obligation);
debug_assert!(!obligation.param_env.has_non_region_infer());
obligation.predicate = infcx.resolve_vars_if_possible(obligation.predicate);
debug!(?obligation, "register_predicate_obligation");