Fix ordering for default impl check in the new solver - #161268
Fix ordering for default impl check in the new solver#161268nnethercote wants to merge 1 commit into
default impl check in the new solver#161268Conversation
The second commit of rust-lang#160605 moved the `default impl` check later, for better performance, which introduced a regression. This commit moves the check a little earlier, so it is after the `args_may_unify` call (thus retaining the perf benefit) but before the `probe_trait_candidate` (which has side-effects). The check is now duplicated in three `GoalKind::consider_impl_candidate` methods, which is unfortunate, but it fits in with the existing duplicated code in those methods. And it means another copy of the check (in `try_assemble_bounds_via_registered_opaques`) can be removed. Fixes rust-lang#160994.
|
|
LLM disclosure: an LLM helped with analysis and review of this PR. I wrote all the code and text myself. |
|
@bors try @rust-timer queue |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Fix ordering for `default impl` check in the new solver
This comment has been minimized.
This comment has been minimized.
|
Finished benchmarking commit (71c4692): comparison URL. Overall result: ❌ regressions - please read:Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf. Next, please: If you can, justify the regressions found in this try perf run in writing along with @bors rollup=never rustc-perf Instruction countOur most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.
Max RSS (memory usage)Results (primary 2.2%)A less reliable metric. May be of interest, but not used to determine the overall result above.
CyclesThis perf run didn't have relevant results for this metric. Binary sizeResults (primary -0.0%, secondary -0.0%)A less reliable metric. May be of interest, but not used to determine the overall result above.
Bootstrap: 458.344s -> 457.305s (-0.23%) |
There was a problem hiding this comment.
one other option: could we change the for_each_relevant_impl and for_each_blanket_impl queries to only return non-default impls and have a separate for_each_default_impl?
r=me on this change itself, even if I quite dislike default impls to negatively impact perf here
The second commit of #160605 moved the
default implcheck later, for better performance, which introduced a regression. This commit moves the check a little earlier, so it is after theargs_may_unifycall (thus retaining the perf benefit) but before theprobe_trait_candidate(which has side-effects).The check is now duplicated in three
GoalKind::consider_impl_candidatemethods, which is unfortunate, but it fits in with the existing duplicated code in those methods. And it means another copy of the check (intry_assemble_bounds_via_registered_opaques) can be removed.Fixes #160994.
r? @lcnr