Skip to content

consider_impl_candidate tweaks - #165794

Merged
rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
nnethercote:consider_impl_candidate
Nov 24, 2026
Merged

rust-bors[bot] merged 3 commits into
rust-lang:mainfrom
nnethercote:consider_impl_candidate

Conversation

@nnethercote

@nnethercote nnethercote commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Cleans up the code a little. Also speeds up the new solver a bit, because putting the fast-reject tests (which almost always trigger an early return) before the calls to consider_impl_candidate avoids the cost of the function calls.

r? @jdonszelmann

It's not needed until much later.
It was duplicated from the one in `trait_goals.rs` but isn't needed.
(And the corresponding `consider_impl_candidate` method in
`normalizes_to.rs` doesn't have it.)
It's now repeated at two call sites instead of within three callees.
Still not ideal, but an improvement.
@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Nov 11, 2026
@nnethercote

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 11, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Nov 11, 2026
@rust-bors

rust-bors Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: d8ae0af (d8ae0aff4061e6226f07dec7fd9df06ae253a7b6)
Base parent: 9c56488 (9c5648833e5ceb667a708d53c00b83ecc9e610d5)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown

Finished benchmarking commit (d8ae0af): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@bors rollup=iffy rustc-perf
@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.2% [-3.6%, -1.6%] 9
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -2.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) - - 0

Cycles

Results (primary -3.0%, secondary -3.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-3.0% [-3.0%, -3.0%] 1
Improvements ✅
(secondary)
-3.9% [-3.9%, -3.9%] 1
All ❌✅ (primary) -3.0% [-3.0%, -3.0%] 1

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 482.775s -> 482.692s (-0.02%)
Artifact size: 406.47 MiB -> 406.44 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Nov 11, 2026
@nnethercote
nnethercote marked this pull request as ready for review November 11, 2026 07:10
@rustbot

rustbot commented Nov 11, 2026

Copy link
Copy Markdown
Collaborator

jdonszelmann is currently at their maximum review capacity.
They may take a while to respond.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Nov 11, 2026
@jdonszelmann

Copy link
Copy Markdown
Contributor

hi there! I like this, some trivial-ish refactors with a nice speed boost. Thanks! @bors r+ rollup=iffy perf

@rust-bors

rust-bors Bot commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 874024d has been approved by jdonszelmann

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 24, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 24, 2026
…e, r=jdonszelmann

`consider_impl_candidate` tweaks

Cleans up the code a little. Also speeds up the new solver a bit, because putting the fast-reject tests (which almost always trigger an early return) before the calls to `consider_impl_candidate` avoids the cost of the function calls.

r? @jdonszelmann
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - #166340 (Revert "implement const Iterator for Range - #156216")
 - #165345 (Remove the 'eq', 'eq_trace', and 'goals_to_obligations' methods from 'At')
 - #165538 (Supertraits returns Unnormalized)
 - #165794 (`consider_impl_candidate` tweaks)
 - #160752 (Avoid inference constraints from opaque blanket impls)
 - #163187 (add `scalbn` and `ilogb` methods on floats)
 - #164541 (Add regression test for #152415)
 - #164543 (Add regression test for #151316)
 - #165920 (Introduce compute_abi helper and ComputeCallConv trait)
 - #166313 (Move `rustdoc-ui` tests in the right folder)
 - #166420 ([rustdoc] Fix search index generation: if crate content didn't change, it should generate the same search index)
 - #166485 (Allow passing `--exact-match` and `--purge` to `x perf`)
@rust-bors
rust-bors Bot merged commit d4fe90a into rust-lang:main Nov 24, 2026
15 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
Rollup merge of #165794 - nnethercote:consider_impl_candidate, r=jdonszelmann

`consider_impl_candidate` tweaks

Cleans up the code a little. Also speeds up the new solver a bit, because putting the fast-reject tests (which almost always trigger an early return) before the calls to `consider_impl_candidate` avoids the cost of the function calls.

r? @jdonszelmann
@nnethercote
nnethercote deleted the consider_impl_candidate branch November 24, 2026 21:26
TDecking pushed a commit to TDecking/miri that referenced this pull request Nov 25, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#166340 (Revert "implement const Iterator for Range - rust-lang/rust#156216")
 - rust-lang/rust#165345 (Remove the 'eq', 'eq_trace', and 'goals_to_obligations' methods from 'At')
 - rust-lang/rust#165538 (Supertraits returns Unnormalized)
 - rust-lang/rust#165794 (`consider_impl_candidate` tweaks)
 - rust-lang/rust#160752 (Avoid inference constraints from opaque blanket impls)
 - rust-lang/rust#163187 (add `scalbn` and `ilogb` methods on floats)
 - rust-lang/rust#164541 (Add regression test for rust-lang/rust#152415)
 - rust-lang/rust#164543 (Add regression test for rust-lang/rust#151316)
 - rust-lang/rust#165920 (Introduce compute_abi helper and ComputeCallConv trait)
 - rust-lang/rust#166313 (Move `rustdoc-ui` tests in the right folder)
 - rust-lang/rust#166420 ([rustdoc] Fix search index generation: if crate content didn't change, it should generate the same search index)
 - rust-lang/rust#166485 (Allow passing `--exact-match` and `--purge` to `x perf`)

ecx.probe_trait_candidate(CandidateSource::Impl(impl_def_id)).enter(|ecx| {
let impl_args = ecx.fresh_args_for_item(impl_def_id.into());
ecx.record_impl_args(impl_args);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removing this feels like a bug 🤔 the fact that no diagnostics are affected here means that's an issue with our test suite

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

InspectCandidate::instantiate_impl_args is the only place that acts on ProbeStep::RecordImplArgs. Can goals other than trait goals reach that path?

We could add the line back to be careful, but I'm not sure it's actually doing anything.

mehmettoplu-rs pushed a commit to mehmettoplu-rs/rustc_codegen_gcc that referenced this pull request Nov 27, 2026
…uwer

Rollup of 12 pull requests

Successful merges:

 - rust-lang/rust#166340 (Revert "implement const Iterator for Range - rust-lang/rust#156216")
 - rust-lang/rust#165345 (Remove the 'eq', 'eq_trace', and 'goals_to_obligations' methods from 'At')
 - rust-lang/rust#165538 (Supertraits returns Unnormalized)
 - rust-lang/rust#165794 (`consider_impl_candidate` tweaks)
 - rust-lang/rust#160752 (Avoid inference constraints from opaque blanket impls)
 - rust-lang/rust#163187 (add `scalbn` and `ilogb` methods on floats)
 - rust-lang/rust#164541 (Add regression test for rust-lang/rust#152415)
 - rust-lang/rust#164543 (Add regression test for rust-lang/rust#151316)
 - rust-lang/rust#165920 (Introduce compute_abi helper and ComputeCallConv trait)
 - rust-lang/rust#166313 (Move `rustdoc-ui` tests in the right folder)
 - rust-lang/rust#166420 ([rustdoc] Fix search index generation: if crate content didn't change, it should generate the same search index)
 - rust-lang/rust#166485 (Allow passing `--exact-match` and `--purge` to `x perf`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants