Skip to content

always rerun if we normalize local opaques - #161795

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
adwinwhite:hidden-is-opaque
Sep 4, 2026
Merged

always rerun if we normalize local opaques#161795
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
adwinwhite:hidden-is-opaque

Conversation

@adwinwhite

@adwinwhite adwinwhite commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

View all comments

Fixes #135062

The problem is that we rerun goals too late such that we compute auto trait for wrongly-marked-as-rigid opaques.
We call type_of on those opaques which would trigger query cycle if we're already in typeck/borrowck of the same opaques.

It's fixed by eagerly rerun if we ever normalize a local opaque.
To be more consersative, we could also rerun if we normalize remote opaque. But that causes regression for wg-grammar. Since we wouldn't be in typeck/borrowck if we're in post analysis mode, we don't have the query cycle problem. We might get away with not rerunning there.

OpaqueInStorage removal doesn't affect behavior and can be done in a followup.

r? @lcnr

@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 Aug 26, 2026
@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.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 26, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 26, 2026
always rerun if we normalize local opaques
@rust-bors

rust-bors Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 82f99bb (82f99bb2d2238f8f809e1242ecfb758690bd0267)
Base parent: 0f33d09 (0f33d0912709e847199218ebab88e2311872f364)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (82f99bb): 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
Regressions ❌
(secondary)
6.8% [4.8%, 10.5%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.3% [-0.4%, -0.2%] 7
All ❌✅ (primary) - - 0

Max RSS (memory usage)

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

Cycles

Results (secondary 5.6%)

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.6% [3.8%, 8.4%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

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

Bootstrap: 475.39s -> 474.699s (-0.15%)
Artifact size: 402.69 MiB -> 402.62 MiB (-0.02%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Aug 26, 2026
self.opaque_accesses.rerun_always(RerunReason::NormalizeOpaqueType)?;
} else {
self.opaque_accesses
.rerun_if_in_post_analysis(RerunReason::NormalizeOpaqueTypeRemoteCrate)?;

@lcnr lcnr Aug 27, 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.

that's also wrong, is it not. We also need to just rerun_always. We need to make sure we never mark an alias as rigid if it's not. We should add this invariant as a comment to ErasedNonCoherence

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.

Doing that basically undoes our perf improvement for wg-grammar. For remote opaques, we won't have query cycle from type_of. Uncertain about other potential problems caused by improperly marked rigid aliases.

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.

okay, yeah 🤔 that's interesting. So instead:

  • always reveal auto traits for rigid aliases, and don't allow "incorrectly rigid local opaques"?

please comment this on ErasedNonCoherence and also IsRigid I think

@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.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 28, 2026
rust-bors Bot pushed a commit that referenced this pull request Aug 28, 2026
always rerun if we normalize local opaques
@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: ca934c3 (ca934c31f1843211718c06bfac5663240c9b03dc)
Base parent: e457a7b (e457a7b0d326d67b4322ef0d11bd715cfaeda48f)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (ca934c3): 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
Regressions ❌
(secondary)
151.2% [4.8%, 310.3%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 2
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 2.9%, secondary 16.9%)

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

mean range count
Regressions ❌
(primary)
2.9% [2.9%, 2.9%] 1
Regressions ❌
(secondary)
16.9% [14.9%, 18.5%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 2.9% [2.9%, 2.9%] 1

Cycles

Results (primary -2.2%, secondary 135.8%)

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)
159.0% [4.3%, 330.4%] 6
Improvements ✅
(primary)
-2.2% [-2.4%, -2.0%] 2
Improvements ✅
(secondary)
-3.6% [-3.6%, -3.6%] 1
All ❌✅ (primary) -2.2% [-2.4%, -2.0%] 2

Binary size

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

Bootstrap: 476.343s -> 475.472s (-0.18%)
Artifact size: 402.74 MiB -> 402.85 MiB (0.03%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 28, 2026
@adwinwhite
adwinwhite marked this pull request as ready for review August 31, 2026 03: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 Aug 31, 2026

@lcnr lcnr 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.

Comment thread compiler/rustc_type_ir/src/infer_ctxt.rs
Comment thread compiler/rustc_type_ir/src/ty_kind.rs Outdated
@rustbot

rustbot commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main 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.

@adwinwhite

Copy link
Copy Markdown
Contributor Author

The actual perf run is the first one and the regression concentrates in a stress test which is very sensitive to changes on opaques.
We discussed it on zulip and think it's acceptable to fix a pass->fail bug.

@rustbot label: +perf-regression-triaged

@bors r=lcnr rollup=never

@rust-bors

rust-bors Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 8720f91 has been approved by lcnr

It is now in the queue for this repository.

🌲 The tree is currently closed for pull requests below priority 10. This pull request will be tested once the tree is reopened.

Reason for tree closure: broken external dependency

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Sep 4, 2026
@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 Sep 4, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Sep 4, 2026
always rerun if we normalize local opaques




Fixes #135062

The problem is that we rerun goals too late such that we compute auto trait for wrongly-marked-as-rigid opaques.
We call `type_of` on those opaques which would trigger query cycle if we're already in typeck/borrowck of the same opaques.

It's fixed by eagerly rerun if we ever normalize a local opaque. 
To be more consersative, we could also rerun if we normalize remote opaque. But that causes regression for `wg-grammar`. Since we wouldn't be in typeck/borrowck if we're in post analysis mode, we don't have the query cycle problem. We **might** get away with not rerunning there.

`OpaqueInStorage` removal doesn't affect behavior and can be done in a followup.

r? @lcnr
@rust-log-analyzer

Copy link
Copy Markdown
Collaborator

The job x86_64-msvc-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)

@rust-bors rust-bors Bot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 4, 2026
@rust-bors

rust-bors Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

💔 Test for 9db98a2 failed: CI. Failed job:

@ShoyuVanilla

Copy link
Copy Markdown
Member

@bors retry

@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 Sep 4, 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 Sep 4, 2026
@rust-bors

rust-bors Bot commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: lcnr
Duration: 3h 9m 58s
Pushing 0ed41eb to main...

@rust-bors
rust-bors Bot merged commit 0ed41eb into rust-lang:main Sep 4, 2026
14 checks passed
@rustbot rustbot added this to the 1.100.0 milestone Sep 4, 2026
@github-actions

github-actions Bot commented Sep 4, 2026

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 b924f94 (parent) -> 0ed41eb (this PR)

Test differences

Show 42 test diffs

Stage 1

  • [ui] tests/ui/traits/next-solver/normalize/always_rerun_normalizing_opaques.rs: [missing] -> pass (J0)
  • [ui (polonius)] tests/ui/traits/next-solver/normalize/always_rerun_normalizing_opaques.rs: [missing] -> pass (J1)

Stage 2

  • [ui] tests/ui/traits/next-solver/normalize/always_rerun_normalizing_opaques.rs: [missing] -> pass (J2)

Additionally, 39 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 0ed41eb4142dda2df61eb1145a312c1a9d62eb56 --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: 1h 49m -> 2h 42m (+47.6%)
  2. x86_64-gnu-parallel-frontend: 1h 24m -> 2h 1m (+44.6%)
  3. dist-android: 25m -> 31m 59s (+27.9%)
  4. dist-riscv64-linux-gnu: 1h 36m -> 1h 10m (-26.8%)
  5. dist-s390x-linux: 1h 14m -> 1h 33m (+25.4%)
  6. x86_64-gnu-distcheck: 2h 26m -> 1h 49m (-25.4%)
  7. x86_64-msvc-ext1: 2h 19m -> 1h 44m (-25.2%)
  8. dist-sparcv9-solaris: 1h 20m -> 1h 40m (+25.0%)
  9. x86_64-gnu-tools: 55m 37s -> 1h 9m (+24.5%)
  10. pr-check-2: 42m 9s -> 32m 4s (-23.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
Copy Markdown
Collaborator

Finished benchmarking commit (0ed41eb): 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
Regressions ❌
(secondary)
6.8% [4.7%, 10.7%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-0.1% [-0.1%, -0.1%] 1
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 6.0%)

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

mean range count
Regressions ❌
(primary)
6.0% [3.1%, 9.0%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 6.0% [3.1%, 9.0%] 2

Cycles

Results (primary -2.9%, secondary 5.4%)

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.4% [3.9%, 7.8%] 3
Improvements ✅
(primary)
-2.9% [-2.9%, -2.9%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -2.9% [-2.9%, -2.9%] 1

Binary size

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

Bootstrap: 480.684s -> 476.718s (-0.83%)
Artifact size: 403.39 MiB -> 403.29 MiB (-0.02%)

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. 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.

Missing Send on "recursive" Future

6 participants