Skip to content

Move placeholder handling to a proper preprocessing step #140466

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 5, 2025

Conversation

amandasystems
Copy link
Contributor

@amandasystems amandasystems commented Apr 29, 2025

This commit breaks out the logic of placheolder rewriting into its own preprocessing step. It's one of the more boring
parts of #130227.

The only functional change from this is that the preprocessing step (where extra r: 'static constraints are added) is performed upstream of Polonius legacy, finally affecting Polonius. That is mostly a by-product, though.

This should be reviewable by anyone in the compiler team, so
r? rust-lang/compiler

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Apr 29, 2025
@lcnr
Copy link
Contributor

lcnr commented Apr 30, 2025

r? lcnr

@rustbot rustbot assigned lcnr and unassigned estebank Apr 30, 2025
@amandasystems amandasystems force-pushed the move-to-preprocessing-step branch from 8b2cab2 to af75e13 Compare May 2, 2025 08:53
@amandasystems amandasystems changed the title [WIP] Move placeholder handling to a proper preprocessing step Move placeholder handling to a proper preprocessing step May 2, 2025
@amandasystems
Copy link
Contributor Author

Ok; revised SCC annotations have landed and I think I addressed all of your concerns so far @lcnr?

@amandasystems amandasystems force-pushed the move-to-preprocessing-step branch from af75e13 to ef9cb23 Compare May 15, 2025 20:05
@amandasystems
Copy link
Contributor Author

@lcnr Fixed all the code review stuff now, I think! I amended it into the second commit.

@amandasystems amandasystems force-pushed the move-to-preprocessing-step branch from ef9cb23 to b1e4ca5 Compare May 26, 2025 15:18
@rustbot

This comment has been minimized.

@amandasystems
Copy link
Contributor Author

@lcnr I think I've addressed all of those now! Except for the one that should probably have a PR of its own or be merged into #140737

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

a few more comment nits, and then finally r=me ☠️ sry

@rustbot

This comment has been minimized.

@rustbot

This comment has been minimized.

This commit breaks out the logic of placheolder rewriting
into its own preprocessing step.

The only functional change from this is that the preprocessing
step (where extra `r: 'static` constraints are added) is
performed upstream of Polonius legacy, finally affecting
Polonius. That is mostly a by-product, though.
@amandasystems amandasystems force-pushed the move-to-preprocessing-step branch from 61f7324 to 49541b2 Compare June 3, 2025 10:21
@rustbot

This comment has been minimized.

Copy link
Contributor

@lcnr lcnr left a comment

Choose a reason for hiding this comment

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

@bors delegate+

@amandasystems amandasystems force-pushed the move-to-preprocessing-step branch from 470dcd7 to f455c4f Compare June 4, 2025 11:27
@rustbot
Copy link
Collaborator

rustbot commented Jun 4, 2025

⚠️ Warning ⚠️

@lcnr
Copy link
Contributor

lcnr commented Jun 4, 2025

@bors r+ rollup=never

@bors
Copy link
Collaborator

bors commented Jun 4, 2025

📌 Commit f455c4f has been approved by lcnr

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 Jun 4, 2025
@bors
Copy link
Collaborator

bors commented Jun 5, 2025

⌛ Testing commit f455c4f with merge 425e142...

@bors
Copy link
Collaborator

bors commented Jun 5, 2025

☀️ Test successful - checks-actions
Approved by: lcnr
Pushing 425e142 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jun 5, 2025
@bors bors merged commit 425e142 into rust-lang:master Jun 5, 2025
11 checks passed
@rustbot rustbot added this to the 1.89.0 milestone Jun 5, 2025
Copy link
Contributor

github-actions bot commented Jun 5, 2025

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 81a964c (parent) -> 425e142 (this PR)

Test differences

Show 12 test diffs

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

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard 425e142686242c7e73f5e32c79071ae266f0f355 --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. dist-aarch64-linux: 7981.6s -> 5665.1s (-29.0%)
  2. x86_64-apple-1: 7196.0s -> 5922.1s (-17.7%)
  3. mingw-check-1: 1889.2s -> 1566.3s (-17.1%)
  4. dist-apple-various: 6840.7s -> 5703.5s (-16.6%)
  5. x86_64-apple-2: 4251.8s -> 3552.1s (-16.5%)
  6. aarch64-apple: 5077.7s -> 4342.9s (-14.5%)
  7. i686-gnu-2: 6156.6s -> 5284.3s (-14.2%)
  8. x86_64-rust-for-linux: 2423.3s -> 2106.9s (-13.1%)
  9. i686-gnu-1: 8150.7s -> 7091.2s (-13.0%)
  10. dist-x86_64-apple: 9736.7s -> 8479.4s (-12.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 (425e142): 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

This is the most reliable metric that we have; it was used to determine the overall result at the top of this comment. However, even this metric can sometimes exhibit noise.

mean range count
Regressions ❌
(primary)
0.1% [0.1%, 0.1%] 1
Regressions ❌
(secondary)
0.2% [0.2%, 0.3%] 8
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.1% [0.1%, 0.1%] 1

Max RSS (memory usage)

Results (secondary 5.7%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

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

Cycles

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

Binary size

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

Bootstrap: 750.423s -> 749.811s (-0.08%)
Artifact size: 371.83 MiB -> 371.77 MiB (-0.02%)

@rustbot rustbot added the perf-regression Performance regression. label Jun 5, 2025
@panstromek
Copy link
Contributor

perf triage:

These regressions look real. One tiny regression in Cargo and two secondary benchmarks - coercions and ucd, which are both based on giant static tables and are somewhat artificial.

I'm inclined to say this is fine as this is a piece of larger important work and the regressions are pretty limited. #130227 (which this PR is part of) does have a bit different perf results, so I guess it will also make more sense asses the perf impact of this work when more pieces of it lands.

Is that a fair assesment?

@amandasystems
Copy link
Contributor Author

I think so, but it’s really strange that this has any performance impact at all. This PR only moves stuff around, the core logic is unchanged.

@amandasystems
Copy link
Contributor Author

amandasystems commented Jun 9, 2025

But yes; it’s supposed to be a part of a larger set of work that would actually change the logic quite substantially. Unfortunately, the first two to three parts are adding redundant mechanisms before the third (or fourth, depending on how you slice it) actually reaps the benefits.

@panstromek
Copy link
Contributor

This PR only moves stuff around, the core logic is unchanged.

Moving stuff around can affect inlining, so this is not that surprising, especially when the perf changes are this small. If this didn't change what the code does, then it's probably just that and it's spurious.

Let's mark this as triaged then, thanks for quick response ;).

@rustbot label: +perf-regression-triaged

@rustbot rustbot added the perf-regression-triaged The performance regression has been triaged. label Jun 9, 2025
bors added a commit that referenced this pull request Jun 9, 2025
Region inference: Use outlives-static constraints in constraint search

Revise the extra `r: 'static` constraints added upon universe issues to add an explanation, and use that explanation during constraint blame search. This greatly simplifies the region inference logic, which now does not need to reverse-engineer the event that caused a region to outlive `'static`.

This cosmetically changes the output of two UI tests. I blessed them i separate commits with separate motivations, but that can of course be squashed as desired. We probably want that.

The PR was extracted out of #130227 and consists of one-third of its functional payload. It is based on #140466, so that has to land first.

We probably want a perf run of this. It shouldn't have much of an impact and a positive one if any, but I have been wrong before. In particular, SCC annotations are heavier now.

r? lcnr
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants