Skip to content

Commit 4283aea

Browse files
committed
Auto merge of rust-lang#119048 - aliemjay:perf-register-pred, r=compiler-errors
don't fold ParamEnv in register_predicate_obligation \>5% perf gain for diesel!
2 parents d14e52b + e0df93b commit 4283aea

File tree

1 file changed

+3
-2
lines changed
  • compiler/rustc_trait_selection/src/traits

1 file changed

+3
-2
lines changed

compiler/rustc_trait_selection/src/traits/fulfill.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,13 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentContext<'tcx> {
116116
fn register_predicate_obligation(
117117
&mut self,
118118
infcx: &InferCtxt<'tcx>,
119-
obligation: PredicateObligation<'tcx>,
119+
mut obligation: PredicateObligation<'tcx>,
120120
) {
121121
assert_eq!(self.usable_in_snapshot, infcx.num_open_snapshots());
122122
// this helps to reduce duplicate errors, as well as making
123123
// debug output much nicer to read and so on.
124-
let obligation = infcx.resolve_vars_if_possible(obligation);
124+
debug_assert!(!obligation.param_env.has_non_region_infer());
125+
obligation.predicate = infcx.resolve_vars_if_possible(obligation.predicate);
125126

126127
debug!(?obligation, "register_predicate_obligation");
127128

0 commit comments

Comments
 (0)