diff options
| author | bors <bors@rust-lang.org> | 2021-03-20 03:49:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2021-03-20 03:49:10 +0000 |
| commit | cd82e451a88ac8b15894af498cdc49e1fe8caa21 (patch) | |
| tree | b1ff6efe12dbca4fcfca0496549ef7204308553e | |
| parent | 6bfbf0c33a86707cedd02ca985285191282a80b3 (diff) | |
| parent | f9257576db1b50137655f9a7ec4b6cb9fa3d6024 (diff) | |
| download | rust-cd82e451a88ac8b15894af498cdc49e1fe8caa21.tar.gz rust-cd82e451a88ac8b15894af498cdc49e1fe8caa21.zip | |
Auto merge of #83293 - osa1:82436_perf, r=varkor
Revert performance-sensitive change in #82436 This change was done in #82436, as an "optimization". Unfortunately I missed that this code is not always executed, because of the "continue" in the conditional above it. This commit should solve the perf regressions introduced by #82436 as I think there isn't anything else that could affect runtime performance in that PR. The `Pick` type grows only one word, which I doubt can cause up to 8.8% increase in RSS in some of the benchmarks. --- Could someone with the rights start a perf job please?
| -rw-r--r-- | compiler/rustc_typeck/src/check/method/probe.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/compiler/rustc_typeck/src/check/method/probe.rs b/compiler/rustc_typeck/src/check/method/probe.rs index 42d7f4c988d..3006cabc632 100644 --- a/compiler/rustc_typeck/src/check/method/probe.rs +++ b/compiler/rustc_typeck/src/check/method/probe.rs @@ -742,9 +742,6 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { debug!("assemble_inherent_impl_probe {:?}", impl_def_id); - let (impl_ty, impl_substs) = self.impl_ty_and_substs(impl_def_id); - let impl_ty = impl_ty.subst(self.tcx, impl_substs); - for item in self.impl_or_trait_item(impl_def_id) { if !self.has_applicable_self(&item) { // No receiver declared. Not a candidate. @@ -752,6 +749,9 @@ impl<'a, 'tcx> ProbeContext<'a, 'tcx> { continue; } + let (impl_ty, impl_substs) = self.impl_ty_and_substs(impl_def_id); + let impl_ty = impl_ty.subst(self.tcx, impl_substs); + // Determine the receiver type that the method itself expects. let xform_tys = self.xform_self_ty(&item, impl_ty, impl_substs); |
