Skip to content

Unify two for_each_relevant_impl methods - #159836

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
adwinwhite:unify-methods
Jul 31, 2026
Merged

Unify two for_each_relevant_impl methods#159836
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
adwinwhite:unify-methods

Conversation

@adwinwhite

@adwinwhite adwinwhite commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

View all comments

We have two similar methods on tcx with the same name. It's confusing.

r? lcnr

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 24, 2026
@rustbot rustbot added 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 Jul 24, 2026
@rust-log-analyzer

This comment has been minimized.

@lcnr

lcnr commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

fun divergence here 🤔

@rustbot author

@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 29, 2026
@rustbot

rustbot commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@rustbot rustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 29, 2026
| ty::Never
| ty::Tuple(_)
| ty::UnsafeBinder(_) => {
if let Some(simp) = ty::fast_reject::simplify_type(

@lcnr lcnr Jul 29, 2026

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.

oh, that's existing, but we should really make this an unwrap. We shouldn't allow not having a simplified type here as that indicates a bug 🤔

View changes since the review

ty::Alias(ty::IsRigid::Yes, _) | ty::Placeholder(..) | ty::Error(_) => (),
// FIXME(-Znext-solver=no): Need to support aliases not marked as
// rigid for the old solver.
ty::Alias(ty::IsRigid::No, _) | ty::Param(_) | ty::Infer(ty::TyVar(_)) => (),

@lcnr lcnr Jul 29, 2026

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.

and that's why old and new impl diverge, we should never call for_each_relevant_impl for infer vars 🤔 would be good to keep TyVar as an ICE and handle it at its call sites

View changes since the review

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.

for_each_relevant_impl is used a lot in diagnostics. Denying ty var would complicate them a bit.

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.

hmm, I do feel like listing applicable impls for ty vars is kind of meh 🤷 I guess we can actually just iterate all impls when used for a ty var and say how that should never be done in the happy path or sth?

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.

you mean an early return? we currently iterate all impls at the end, after matching self_ty.

@ChayimFriedman2 ChayimFriedman2 left a comment

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.

You reverted #156295, please revert that.

View changes since this review

@rust-log-analyzer

This comment has been minimized.

@lcnr

lcnr commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@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 Jul 30, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 30, 2026
Unify two `for_each_relevant_impl` methods
@lcnr

lcnr commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

@bors cancel

@rust-bors

rust-bors Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

❗ There is currently no auto build in progress on this PR.

Hint: There is a pending try build on this PR. Maybe you meant to cancel it? You can do that using @bors try cancel.

@rust-bors

rust-bors Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 7017c2c failed: CI. Failed job:

@rust-log-analyzer

This comment has been minimized.

@adwinwhite

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jul 31, 2026
Unify two `for_each_relevant_impl` methods
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 9951eb3 (9951eb3792e6ea9f7cd97c90f0371d5a62024a14)
Base parent: 8ab9fdf (8ab9fdff5a91b9f2b5ed57fb0275452d9a0d0280)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (9951eb3): comparison URL.

Overall result: ❌✅ regressions and improvements - 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 @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never 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.2% [0.2%, 0.2%] 3
Regressions ❌
(secondary)
0.2% [0.2%, 0.3%] 10
Improvements ✅
(primary)
-4.0% [-20.7%, -0.2%] 11
Improvements ✅
(secondary)
-0.6% [-0.8%, -0.3%] 5
All ❌✅ (primary) -3.1% [-20.7%, 0.2%] 14

Max RSS (memory usage)

Results (primary -1.4%, secondary 0.5%)

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)
5.8% [5.8%, 5.8%] 1
Improvements ✅
(primary)
-1.4% [-2.4%, -0.5%] 8
Improvements ✅
(secondary)
-0.5% [-0.7%, -0.4%] 5
All ❌✅ (primary) -1.4% [-2.4%, -0.5%] 8

Cycles

Results (primary -2.3%, secondary -1.2%)

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

mean range count
Regressions ❌
(primary)
1.1% [0.4%, 1.6%] 7
Regressions ❌
(secondary)
0.6% [0.5%, 0.7%] 3
Improvements ✅
(primary)
-6.2% [-15.6%, -0.9%] 6
Improvements ✅
(secondary)
-1.9% [-5.9%, -0.4%] 8
All ❌✅ (primary) -2.3% [-15.6%, 1.6%] 13

Binary size

Results (primary -0.0%, secondary -0.0%)

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.0% [-0.1%, -0.0%] 23
Improvements ✅
(secondary)
-0.0% [-0.1%, -0.0%] 5
All ❌✅ (primary) -0.0% [-0.1%, -0.0%] 23

Bootstrap: 492.09s -> 490.67s (-0.29%)
Artifact size: 390.63 MiB -> 390.44 MiB (-0.05%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jul 31, 2026
@lcnr

lcnr commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

@bors r+ rollup=never

@rust-bors

rust-bors Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a070b70 has been approved by lcnr

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 31, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 31, 2026
@rust-bors

rust-bors Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: lcnr
Duration: 3h 22m 6s
Pushing 64af19d to main...

@rust-bors
rust-bors Bot merged commit 64af19d into rust-lang:main Jul 31, 2026
14 checks passed
@rustbot rustbot added this to the 1.99.0 milestone Jul 31, 2026
@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing fc0f51f (parent) -> 64af19d (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 64af19d44c63587455c76f484ce76261a9971e96 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. x86_64-gnu-gcc-core-tests: 7m 34s -> 14m 9s (+86.9%)
  2. x86_64-gnu-llvm-21-1: 38m 50s -> 57m 41s (+48.5%)
  3. x86_64-gnu-gcc: 49m 24s -> 1h 7m (+36.1%)
  4. dist-arm-linux-musl: 1h 20m -> 1h 47m (+34.7%)
  5. x86_64-gnu-aux: 1h 47m -> 2h 25m (+34.5%)
  6. x86_64-msvc-2: 2h 36m -> 1h 47m (-31.2%)
  7. dist-x86_64-msvc-alt: 2h 13m -> 2h 50m (+27.2%)
  8. pr-check-1: 26m 21s -> 33m 20s (+26.5%)
  9. dist-various-2: 33m 50s -> 42m 30s (+25.6%)
  10. dist-arm-linux-gnueabi: 1h 11m -> 1h 29m (+24.8%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (64af19d): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

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.2% [0.2%, 0.2%] 4
Regressions ❌
(secondary)
0.2% [0.2%, 0.2%] 9
Improvements ✅
(primary)
-2.8% [-20.6%, -0.2%] 16
Improvements ✅
(secondary)
-0.5% [-0.8%, -0.3%] 7
All ❌✅ (primary) -2.2% [-20.6%, 0.2%] 20

Max RSS (memory usage)

Results (primary -1.0%, secondary -1.7%)

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

mean range count
Regressions ❌
(primary)
2.7% [2.4%, 2.9%] 2
Regressions ❌
(secondary)
1.5% [0.7%, 2.2%] 2
Improvements ✅
(primary)
-1.5% [-3.4%, -0.4%] 16
Improvements ✅
(secondary)
-2.9% [-5.8%, -0.4%] 5
All ❌✅ (primary) -1.0% [-3.4%, 2.9%] 18

Cycles

Results (primary -3.1%, secondary 0.1%)

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

mean range count
Regressions ❌
(primary)
0.7% [0.6%, 0.8%] 2
Regressions ❌
(secondary)
2.1% [0.9%, 3.8%] 4
Improvements ✅
(primary)
-3.8% [-16.0%, -0.6%] 11
Improvements ✅
(secondary)
-0.8% [-1.7%, -0.5%] 10
All ❌✅ (primary) -3.1% [-16.0%, 0.8%] 13

Binary size

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

Bootstrap: 491.246s -> 492.106s (0.18%)
Artifact size: 390.66 MiB -> 390.46 MiB (-0.05%)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. 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.

6 participants