Skip to content

Split TypeFolder and FallibleTypeFolder atwain #139768

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
Apr 16, 2025

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Apr 13, 2025

Right now there is a coherence problem with TypeFolder and FallibleTypeFolder. Namely, it's impossible to implement a FallibleTypeFolder that is generic over interner, b/c it has a downstream conflict with the blanket impl:

impl<I, F> FallibleTypeFolder<I> for F where F: TypeFolder<I> {}

Because downstream crates may implement TypeFolder<SomeLocalInterner> for the fallible type folder.

This PR removes the relationship between FallibleTypeFolder and TypeFolder; it leads to modest code duplication, but otherwise does not affect perf and really doesn't matter in general.

@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 13, 2025
@compiler-errors
Copy link
Member 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 Apr 13, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 13, 2025
[Experiment] Split `TypeFolder` and `FallibleTypeFolder`

r? `@ghost`
@bors
Copy link
Collaborator

bors commented Apr 13, 2025

⌛ Trying commit b960283 with merge 8e1d888...

@rust-log-analyzer

This comment has been minimized.

@bors
Copy link
Collaborator

bors commented Apr 14, 2025

☀️ Try build successful - checks-actions
Build commit: 8e1d888 (8e1d8887124a865cf9fe302bf52d2ac626275866)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (8e1d888): comparison URL.

Overall result: ✅ improvements - no action needed

Benchmarking this pull request likely means that it is perf-sensitive, so we're automatically marking it as not fit for rolling up. While you can manually mark this PR as fit for rollup, we strongly recommend not doing so since this PR may lead to changes in compiler perf.

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

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
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.2% [-0.2%, -0.2%] 3
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.2% [-0.2%, -0.2%] 3

Max RSS (memory usage)

Results (secondary -1.2%)

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

Cycles

Results (primary 2.4%)

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

Binary size

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

Bootstrap: 779.607s -> 776.511s (-0.40%)
Artifact size: 365.51 MiB -> 365.50 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Apr 14, 2025
@lcnr
Copy link
Contributor

lcnr commented Apr 14, 2025

sgtm, seems like the easiest solution to avoid the coherence issue

@compiler-errors
Copy link
Member Author

I'm going to at least add a macro to deduplicate all the (trivial) list folder impls, since those seem to be the majority of the bulky duplication here.

@@ -931,6 +931,8 @@ pub enum TerminatorKind<'tcx> {
asm_macro: InlineAsmMacro,

/// The template for the inline assembly, with placeholders.
#[type_foldable(identity)]
Copy link
Member Author

Choose a reason for hiding this comment

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

Ideally we'd have most of these MIR fields marked as ignore/identity, but these are the only ones that we need to get rid of some annoying noop impls.

@compiler-errors compiler-errors marked this pull request as ready for review April 14, 2025 15:15
@rustbot
Copy link
Collaborator

rustbot commented Apr 14, 2025

This PR changes MIR

cc @oli-obk, @RalfJung, @JakobDegen, @davidtwco, @vakaras

@compiler-errors
Copy link
Member Author

r? lcnr

@compiler-errors compiler-errors changed the title [Experiment] Split TypeFolder and FallibleTypeFolder Split TypeFolder and FallibleTypeFolder Apr 14, 2025
@compiler-errors compiler-errors changed the title Split TypeFolder and FallibleTypeFolder Split TypeFolder and FallibleTypeFolder atwain Apr 14, 2025
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.

some nits, then r=me

@compiler-errors
Copy link
Member Author

@bors r=lcnr rollup

@bors
Copy link
Collaborator

bors commented Apr 16, 2025

📌 Commit c774adc has been approved by lcnr

It is now in the queue for this repository.

@compiler-errors
Copy link
Member Author

@bors rollup=never

@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 Apr 16, 2025
@bors
Copy link
Collaborator

bors commented Apr 16, 2025

⌛ Testing commit c774adc with merge efb1e3d...

@bors
Copy link
Collaborator

bors commented Apr 16, 2025

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Apr 16, 2025
@bors bors merged commit efb1e3d into rust-lang:master Apr 16, 2025
7 checks passed
@rustbot rustbot added this to the 1.88.0 milestone Apr 16, 2025
Copy link

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 cacb9ee (parent) -> efb1e3d (this PR)

Test differences

Show 23 test diffs

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

Job duration changes

  1. x86_64-apple-2: 6496.4s -> 3900.2s (-40.0%)
  2. dist-apple-various: 7598.2s -> 6093.8s (-19.8%)
  3. arm-android: 5403.8s -> 6031.8s (11.6%)
  4. dist-aarch64-apple: 4775.2s -> 4357.3s (-8.8%)
  5. x86_64-gnu-llvm-19-2: 5575.7s -> 6001.7s (7.6%)
  6. x86_64-gnu-tools: 6222.5s -> 5840.2s (-6.1%)
  7. dist-x86_64-apple: 8596.0s -> 9090.3s (5.8%)
  8. dist-loongarch64-linux: 6605.6s -> 6290.0s (-4.8%)
  9. i686-msvc-1: 9817.7s -> 9356.0s (-4.7%)
  10. dist-aarch64-msvc: 8547.7s -> 8938.3s (4.6%)
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 (efb1e3d): comparison URL.

Overall result: ✅ improvements - no action needed

@rustbot label: -perf-regression

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

Max RSS (memory usage)

Results (primary -0.5%)

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)
1.0% [0.9%, 1.1%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.7% [-2.6%, -0.4%] 14
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -0.5% [-2.6%, 1.1%] 16

Cycles

Results (primary -0.2%, secondary -2.6%)

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.4% [0.4%, 0.5%] 2
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
-0.5% [-0.6%, -0.4%] 5
Improvements ✅
(secondary)
-2.6% [-2.6%, -2.6%] 1
All ❌✅ (primary) -0.2% [-0.6%, 0.5%] 7

Binary size

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

Bootstrap: 782.111s -> 774.579s (-0.96%)
Artifact size: 364.73 MiB -> 364.75 MiB (0.01%)

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

6 participants