Skip to content

Don't recompute DisambiguatorState for every RPITIT in trait definition #143258

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 1 commit into from
Jul 2, 2025

Conversation

compiler-errors
Copy link
Member

@compiler-errors compiler-errors commented Jun 30, 2025

The associated_type_for_impl_trait_in_trait currently needs to rerun the RPITVisitor for every RPITIT to compute its disambiguator.

Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the associated_types_for_impl_traits_in_associated_fn query. There we can just share the same DisambiguatorState for all the RPITITs in one function signature.

r? @Zoxc or @oli-obk cc #140453

@rustbot
Copy link
Collaborator

rustbot commented Jun 30, 2025

Failed to set assignee to Zoxc: invalid assignee

Note: Only org members with at least the repository "read" role, users with write permissions, or people who have commented on the PR may be assigned.

@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 Jun 30, 2025
@rustbot
Copy link
Collaborator

rustbot commented Jun 30, 2025

HIR ty lowering was modified

cc @fmease

@Zoxc
Copy link
Contributor

Zoxc commented Jun 30, 2025

The query removal looks reasonable to me.

It seems like it would make one solution to #140796 easier too. Namely making functions with the same name share DisambiguatorState.

@oli-obk
Copy link
Contributor

oli-obk commented Jul 1, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 1, 2025

📌 Commit 08278eb has been approved by oli-obk

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 Jul 1, 2025
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 1, 2025
…e, r=oli-obk

Don't recompute `DisambiguatorState` for every RPITIT in trait definition

The `associated_type_for_impl_trait_in_trait` currently needs to rerun the `RPITVisitor` for every RPITIT to compute its disambiguator.

Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the `associated_types_for_impl_traits_in_associated_fn` query. There we can just share the same `DisambiguatorState` for all the RPITITs in one function signature.

r? `@Zoxc` or `@oli-obk` cc rust-lang#140453
bors added a commit that referenced this pull request Jul 2, 2025
Rollup of 12 pull requests

Successful merges:

 - #141829 (Specialize sleep_until implementation for unix (except mac))
 - #141847 (Explain `TOCTOU` on the top of `std::fs`, and reference it in functions)
 - #142138 (Add `Vec::into_chunks`)
 - #142321 (Expose elf abi on ppc64 targets)
 - #142568 (Use the .drectve section for exporting symbols from dlls on Windows)
 - #142886 (ci: aarch64-gnu: Stop skipping `panic_abort_doc_tests`)
 - #143038 (avoid suggesting traits from private dependencies)
 - #143194 (fix bitcast of single-element SIMD vectors)
 - #143206 (Align attr fixes)
 - #143258 (Don't recompute `DisambiguatorState` for every RPITIT in trait definition)
 - #143260 (Use the correct export kind for __rust_alloc_error_handler_should_panic)
 - #143274 (ci: support optional jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 2, 2025
…e, r=oli-obk

Don't recompute `DisambiguatorState` for every RPITIT in trait definition

The `associated_type_for_impl_trait_in_trait` currently needs to rerun the `RPITVisitor` for every RPITIT to compute its disambiguator.

Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the `associated_types_for_impl_traits_in_associated_fn` query. There we can just share the same `DisambiguatorState` for all the RPITITs in one function signature.

r? ``@Zoxc`` or ``@oli-obk`` cc rust-lang#140453
bors added a commit that referenced this pull request Jul 2, 2025
Rollup of 11 pull requests

Successful merges:

 - #141829 (Specialize sleep_until implementation for unix (except mac))
 - #141847 (Explain `TOCTOU` on the top of `std::fs`, and reference it in functions)
 - #142138 (Add `Vec::into_chunks`)
 - #142321 (Expose elf abi on ppc64 targets)
 - #142886 (ci: aarch64-gnu: Stop skipping `panic_abort_doc_tests`)
 - #143038 (avoid suggesting traits from private dependencies)
 - #143194 (fix bitcast of single-element SIMD vectors)
 - #143206 (Align attr fixes)
 - #143258 (Don't recompute `DisambiguatorState` for every RPITIT in trait definition)
 - #143260 (Use the correct export kind for __rust_alloc_error_handler_should_panic)
 - #143274 (ci: support optional jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
jhpratt added a commit to jhpratt/rust that referenced this pull request Jul 2, 2025
…e, r=oli-obk

Don't recompute `DisambiguatorState` for every RPITIT in trait definition

The `associated_type_for_impl_trait_in_trait` currently needs to rerun the `RPITVisitor` for every RPITIT to compute its disambiguator.

Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the `associated_types_for_impl_traits_in_associated_fn` query. There we can just share the same `DisambiguatorState` for all the RPITITs in one function signature.

r? ```@Zoxc``` or ```@oli-obk``` cc rust-lang#140453
bors added a commit that referenced this pull request Jul 2, 2025
Rollup of 12 pull requests

Successful merges:

 - #141847 (Explain `TOCTOU` on the top of `std::fs`, and reference it in functions)
 - #142138 (Add `Vec::into_chunks`)
 - #142321 (Expose elf abi on ppc64 targets)
 - #142886 (ci: aarch64-gnu: Stop skipping `panic_abort_doc_tests`)
 - #143038 (avoid suggesting traits from private dependencies)
 - #143194 (fix bitcast of single-element SIMD vectors)
 - #143206 (Align attr fixes)
 - #143231 (Suggest use another lifetime specifier instead of underscore lifetime)
 - #143232 ([COMPILETEST-UNTANGLE 3/N] Use "directives" consistently within compiletest)
 - #143258 (Don't recompute `DisambiguatorState` for every RPITIT in trait definition)
 - #143260 (Use the correct export kind for __rust_alloc_error_handler_should_panic)
 - #143274 (ci: support optional jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 2, 2025
…e, r=oli-obk

Don't recompute `DisambiguatorState` for every RPITIT in trait definition

The `associated_type_for_impl_trait_in_trait` currently needs to rerun the `RPITVisitor` for every RPITIT to compute its disambiguator.

Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the `associated_types_for_impl_traits_in_associated_fn` query. There we can just share the same `DisambiguatorState` for all the RPITITs in one function signature.

r? ````@Zoxc```` or ````@oli-obk```` cc rust-lang#140453
bors added a commit that referenced this pull request Jul 2, 2025
Rollup of 11 pull requests

Successful merges:

 - #141847 (Explain `TOCTOU` on the top of `std::fs`, and reference it in functions)
 - #142138 (Add `Vec::into_chunks`)
 - #142321 (Expose elf abi on ppc64 targets)
 - #142886 (ci: aarch64-gnu: Stop skipping `panic_abort_doc_tests`)
 - #143038 (avoid suggesting traits from private dependencies)
 - #143194 (fix bitcast of single-element SIMD vectors)
 - #143231 (Suggest use another lifetime specifier instead of underscore lifetime)
 - #143232 ([COMPILETEST-UNTANGLE 3/N] Use "directives" consistently within compiletest)
 - #143258 (Don't recompute `DisambiguatorState` for every RPITIT in trait definition)
 - #143260 (Use the correct export kind for __rust_alloc_error_handler_should_panic)
 - #143274 (ci: support optional jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 2, 2025
…e, r=oli-obk

Don't recompute `DisambiguatorState` for every RPITIT in trait definition

The `associated_type_for_impl_trait_in_trait` currently needs to rerun the `RPITVisitor` for every RPITIT to compute its disambiguator.

Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the `associated_types_for_impl_traits_in_associated_fn` query. There we can just share the same `DisambiguatorState` for all the RPITITs in one function signature.

r? `````@Zoxc````` or `````@oli-obk````` cc rust-lang#140453
bors added a commit that referenced this pull request Jul 2, 2025
Rollup of 10 pull requests

Successful merges:

 - #141847 (Explain `TOCTOU` on the top of `std::fs`, and reference it in functions)
 - #142138 (Add `Vec::into_chunks`)
 - #142321 (Expose elf abi on ppc64 targets)
 - #142886 (ci: aarch64-gnu: Stop skipping `panic_abort_doc_tests`)
 - #143194 (fix bitcast of single-element SIMD vectors)
 - #143231 (Suggest use another lifetime specifier instead of underscore lifetime)
 - #143232 ([COMPILETEST-UNTANGLE 3/N] Use "directives" consistently within compiletest)
 - #143258 (Don't recompute `DisambiguatorState` for every RPITIT in trait definition)
 - #143260 (Use the correct export kind for __rust_alloc_error_handler_should_panic)
 - #143274 (ci: support optional jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit that referenced this pull request Jul 2, 2025
Rollup of 9 pull requests

Successful merges:

 - #141847 (Explain `TOCTOU` on the top of `std::fs`, and reference it in functions)
 - #142138 (Add `Vec::into_chunks`)
 - #142321 (Expose elf abi on ppc64 targets)
 - #142886 (ci: aarch64-gnu: Stop skipping `panic_abort_doc_tests`)
 - #143194 (fix bitcast of single-element SIMD vectors)
 - #143231 (Suggest use another lifetime specifier instead of underscore lifetime)
 - #143232 ([COMPILETEST-UNTANGLE 3/N] Use "directives" consistently within compiletest)
 - #143258 (Don't recompute `DisambiguatorState` for every RPITIT in trait definition)
 - #143274 (ci: support optional jobs)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7fa00aa into rust-lang:master Jul 2, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 2, 2025
rust-timer added a commit that referenced this pull request Jul 2, 2025
Rollup merge of #143258 - compiler-errors:disambiguator-state, r=oli-obk

Don't recompute `DisambiguatorState` for every RPITIT in trait definition

The `associated_type_for_impl_trait_in_trait` currently needs to rerun the `RPITVisitor` for every RPITIT to compute its disambiguator.

Instead of synthesizing all of the RPITITs def ids one at a time in different queries, just synthesize them inside of the `associated_types_for_impl_traits_in_associated_fn` query. There we can just share the same `DisambiguatorState` for all the RPITITs in one function signature.

r? ``````@Zoxc`````` or ``````@oli-obk`````` cc #140453
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

5 participants