diff options
| author | bors <bors@rust-lang.org> | 2023-12-17 18:27:09 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-12-17 18:27:09 +0000 |
| commit | 4283aeaca5c0c14864d4af3369a42c6b8b21f80f (patch) | |
| tree | 2dd4005d2c1a35d9368dfb76b0daf98ea770834a | |
| parent | d14e52b47ab27bcc3c3e083ed5f009a57db63eff (diff) | |
| parent | e0df93b07e79d22cf56536a63c57d3b11748d569 (diff) | |
| download | rust-4283aeaca5c0c14864d4af3369a42c6b8b21f80f.tar.gz rust-4283aeaca5c0c14864d4af3369a42c6b8b21f80f.zip | |
Auto merge of #119048 - aliemjay:perf-register-pred, r=compiler-errors
don't fold ParamEnv in register_predicate_obligation \>5% perf gain for diesel!
| -rw-r--r-- | compiler/rustc_trait_selection/src/traits/fulfill.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/compiler/rustc_trait_selection/src/traits/fulfill.rs b/compiler/rustc_trait_selection/src/traits/fulfill.rs index 9cbddd2bb2b..045d7e444b6 100644 --- a/compiler/rustc_trait_selection/src/traits/fulfill.rs +++ b/compiler/rustc_trait_selection/src/traits/fulfill.rs @@ -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"); |
