Skip to content

Conversation

lcnr
Copy link
Contributor

@lcnr lcnr commented Sep 8, 2025

Based on #140405.

fixes rust-lang/trait-system-refactor-initiative#182
fixes rust-lang/trait-system-refactor-initiative#196
fixes rust-lang/trait-system-refactor-initiative#205

there's some jank here, see rust-lang/trait-system-refactor-initiative#229

Design

If the self type is an inference variable which has been sub-unified with am opaque type, we need to incompletely guide inference to avoid breakage.

In this case, we

  • look at the item bounds of all sub-unified opaque types, and
  • blanket impls which do not constrain the self type

Even if there are applicable candidates, we always force their certainty to be Maybe, so they will always have to be reproven once we've constrained the inference variable.

This is a bit iffy, see the added tests.

r? @BoxyUwU

@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 Sep 8, 2025
@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Sep 8, 2025

☔ The latest upstream changes (presumably #146333) made this pull request unmergeable. Please resolve the merge conflicts.

@lcnr lcnr force-pushed the opaque-type-infer-alias-candidates branch 4 times, most recently from c3adc9d to 5c29fd3 Compare September 10, 2025 11:27
@rust-log-analyzer

This comment has been minimized.

@lcnr lcnr force-pushed the opaque-type-infer-alias-candidates branch 2 times, most recently from d8001d5 to cd7358d Compare September 10, 2025 12:32
@lcnr lcnr marked this pull request as ready for review September 10, 2025 12:36
@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 Sep 10, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Sep 10, 2025

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

rust-bors bot added a commit that referenced this pull request Sep 10, 2025
consider item bounds for non-yet-defined opaque types
@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Sep 10, 2025
@rust-bors

This comment has been minimized.

@lcnr lcnr force-pushed the opaque-type-infer-alias-candidates branch from cd7358d to a156ca8 Compare September 10, 2025 12:40
@lcnr lcnr force-pushed the opaque-type-infer-alias-candidates branch from 8b1988d to fba7203 Compare September 10, 2025 14:27
@rust-bors
Copy link

rust-bors bot commented Sep 10, 2025

☀️ Try build successful (CI)
Build commit: 86e299c (86e299c4ac5f5f35d68e41729747c56e53dc5001, parent: 7ad23f43a225546c095123de52cc07d8719f8e2b)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (86e299c): comparison URL.

Overall result: ❌ regressions - please read the text below

Benchmarking this pull request means it may be perf-sensitive – we'll automatically label it not fit for rolling up. You can override this, but we strongly advise not to, due to possible changes in compiler perf.

Next Steps: If you can justify the regressions found in this try perf run, please do so in sufficient writing along with @rustbot label: +perf-regression-triaged. If not, please fix the regressions and do another perf run. If its results are neutral or positive, the label will be automatically removed.

@bors rollup=never
@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.4% [0.1%, 0.8%] 10
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 2.4%)

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

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

Cycles

Results (secondary 3.2%)

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)
3.2% [3.1%, 3.3%] 2
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 469.26s -> 469.264s (0.00%)
Artifact size: 387.51 MiB -> 387.71 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 Sep 10, 2025
@lcnr
Copy link
Contributor Author

lcnr commented Sep 10, 2025

damn, these regressions are tiny. gamer!

@lcnr
Copy link
Contributor Author

lcnr commented Sep 10, 2025

@bors r=BoxyUwU

@bors
Copy link
Collaborator

bors commented Sep 10, 2025

📌 Commit fba7203 has been approved by BoxyUwU

It is now in the queue for this repository.

@bors bors 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 Sep 10, 2025
@BoxyUwU
Copy link
Member

BoxyUwU commented Sep 10, 2025

gamer!

@lcnr lcnr force-pushed the opaque-type-infer-alias-candidates branch from fba7203 to cf224ea Compare September 11, 2025 10:13
@rustbot
Copy link
Collaborator

rustbot commented Sep 11, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@lcnr
Copy link
Contributor Author

lcnr commented Sep 11, 2025

@bors r=BoxyUwU

@bors
Copy link
Collaborator

bors commented Sep 11, 2025

📌 Commit cf224ea has been approved by BoxyUwU

It is now in the queue for this repository.

@Zalathar
Copy link
Contributor

Giving this a priority bump over the rollup=iffy PR in case the rollup fails.

@bors p=1

@bors
Copy link
Collaborator

bors commented Sep 12, 2025

⌛ Testing commit cf224ea with merge a171994...

@bors
Copy link
Collaborator

bors commented Sep 12, 2025

☀️ Test successful - checks-actions
Approved by: BoxyUwU
Pushing a171994 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Sep 12, 2025
@bors bors merged commit a171994 into rust-lang:master Sep 12, 2025
11 checks passed
@rustbot rustbot added this to the 1.91.0 milestone Sep 12, 2025
Copy link
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 408eacf (parent) -> a171994 (this PR)

Test differences

Show 63 test diffs

Stage 1

  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket-2.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket-2.rs#next: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket-3.rs: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket.rs#next: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/multiple-opaques-ambig.rs: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/multiple-opaques-ok.rs: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/no-rigid-alias.rs: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-blanket-impl.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-blanket-impl.rs#next: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-item-bound-over-blanket-impl.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-item-bound-over-blanket-impl.rs#next: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-item-bound.rs#current: [missing] -> pass (J0)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-item-bound.rs#next: [missing] -> pass (J0)

Stage 2

  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket-2.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket-2.rs#next: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket-3.rs: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/avoid-inference-constraints-from-blanket.rs#next: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/multiple-opaques-ambig.rs: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/multiple-opaques-ok.rs: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/no-rigid-alias.rs: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-blanket-impl.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-blanket-impl.rs#next: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-item-bound-over-blanket-impl.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-item-bound-over-blanket-impl.rs#next: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-item-bound.rs#current: [missing] -> pass (J1)
  • [ui] tests/ui/impl-trait/non-defining-uses/use-item-bound.rs#next: [missing] -> pass (J1)

Additionally, 35 doctest diffs were found. These are ignored, as they are noisy.

Job group index

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard a171994070dc18c3a32fc1aa2d98cf03ae96b63e --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-llvm-19-1: 3411.4s -> 3977.3s (16.6%)
  2. i686-gnu-nopt-1: 7333.0s -> 8168.3s (11.4%)
  3. aarch64-gnu-debug: 3781.4s -> 4183.8s (10.6%)
  4. x86_64-rust-for-linux: 2621.1s -> 2870.0s (9.5%)
  5. i686-gnu-2: 5538.9s -> 5975.8s (7.9%)
  6. x86_64-gnu-llvm-20-2: 5479.7s -> 5895.7s (7.6%)
  7. dist-powerpc64le-linux-musl: 5091.8s -> 5461.9s (7.3%)
  8. pr-check-1: 1362.7s -> 1458.6s (7.0%)
  9. x86_64-gnu-miri: 4508.8s -> 4825.9s (7.0%)
  10. dist-armhf-linux: 5083.2s -> 4734.4s (-6.9%)
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
Collaborator

Finished benchmarking commit (a171994): comparison URL.

Overall result: ❌ regressions - please read the text below

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
Regressions ❌
(secondary)
0.5% [0.2%, 0.8%] 11
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.4% [-0.4%, -0.4%] 1
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)
1.0% [1.0%, 1.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.0% [-4.5%, -3.4%] 2
All ❌✅ (primary) - - 0

Cycles

This benchmark run did not return any relevant results for this metric.

Binary size

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

Bootstrap: 468.519s -> 469.518s (0.21%)
Artifact size: 387.84 MiB -> 388.08 MiB (0.06%)

@lcnr lcnr deleted the opaque-type-infer-alias-candidates branch September 13, 2025 15:33
@panstromek
Copy link
Contributor

perf triage:

tt-muncher, ucd and tuple-stress all look like noise to me. The rest is in new-solver, which is still WIP and not enabled by default.

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 15, 2025
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. perf-regression-triaged The performance regression has been triaged. 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
9 participants