Skip to content

Replace most Ty::new_fn_def calls with type_of queries directly - #159665

Merged
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
addiesh:turbofish-fear-me
Jul 28, 2026
Merged

Replace most Ty::new_fn_def calls with type_of queries directly#159665
rust-bors[bot] merged 1 commit into
rust-lang:mainfrom
addiesh:turbofish-fear-me

Conversation

@addiesh

@addieshaddiesh commented Jul 21, 2026

Copy link
Copy Markdown

This is so we can reduce the amount of code and changes in #159403. It should stand on its own, but really it's meant as an extended part of 159403.

This allows getting the right ty::FnDef even cross-crate, as the type_of query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via fn_sig, but using that is somewhat overkill and can cause cycle errors in some cases.

@rustbotrustbot 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. labels Jul 21, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Thanks for the pull request, and welcome! The Rust Project is excited to review your changes, and you should hear from @oli-obk (or someone else) some time within the next two weeks.

Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (S-waiting-on-review and S-waiting-on-author) stays updated, invoking these commands when appropriate:

  • @rustbot author: the review is finished, PR author should check the comments and take action accordingly
  • @rustbot review: the author is ready for a review, this PR will be queued again in the reviewer's queue

@addiesh

Copy link
Copy Markdown
Author

i wish github supported funnier reactions for PRs so I could 😭 when CI fails

@oli-obk

Copy link
Copy Markdown
Contributor

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbotrustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 21, 2026
@rust-bors

This comment has been minimized.

rust-borsBot pushed a commit that referenced this pull request Jul 21, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly
@rust-bors

rust-borsBot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 221275a (221275a593e1700a6824feb1f05823991afce3f1)
Base parent: f65b272 (f65b272fc92b1e7527dea4a224430a249ab25c2d)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (221275a): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

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

Max RSS (memory usage)

Results (primary 1.7%, secondary -0.1%)

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

meanrangecount
Regressions ❌
(primary)
1.7%[1.7%, 1.7%]1
Regressions ❌
(secondary)
3.8%[2.5%, 5.0%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
-2.7%[-4.0%, -1.5%]3
All ❌✅ (primary)1.7%[1.7%, 1.7%]1

Cycles

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

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.

meanrangecount
Regressions ❌
(primary)
0.0%[0.0%, 0.0%]4
Regressions ❌
(secondary)
0.0%[0.0%, 0.1%]16
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)0.0%[0.0%, 0.0%]4

Bootstrap: 487.415s -> 487.919s (0.10%)
Artifact size: 387.80 MiB -> 387.86 MiB (0.02%)

@rustbotrustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jul 22, 2026
@oli-obk
oli-obk marked this pull request as ready for review July 22, 2026 09:46
@rustbot

Copy link
Copy Markdown
Collaborator

HIR ty lowering was modified

cc @fmease

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in match lowering

cc @Nadrieril

@rustbotrustbot 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 Jul 22, 2026
Comment threadcompiler/rustc_hir_analysis/src/hir_ty_lowering/mod.rs Outdated
Comment threadcompiler/rustc_middle/src/ty/sty.rs Outdated
@rustbotrustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 22, 2026
@rustbot

Copy link
Copy Markdown
Collaborator

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@addiesh

Copy link
Copy Markdown
Author

@rustbot ready

@rustbotrustbot 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 Jul 23, 2026
@rust-bors

This comment has been minimized.

@oli-obkoli-obk 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.

@bors delegate+

r=me with commit message matching the PR message

View changes since this review

@rust-bors

rust-borsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

✌️ @addiesh, you can now approve this pull request!

If @oli-obk told you to "r=me" after making some further change, then please make that change and post @bors r=oli-obk.

View changes since this delegation.

@rustbotrustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 28, 2026
@rustbotrustbot added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Jul 28, 2026
@rustbot

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.

@addiesh

Copy link
Copy Markdown
Author

@bors r=oli-obk

@rust-bors

rust-borsBot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 7b8f260 has been approved by oli-obk

It is now in the queue for this repository.

@rust-borsrust-borsBot 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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jul 28, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly
This is so we can reduce the amount of code and changes in rust-lang#159403. It should stand on its own, but really it's meant as an extended part of 159403.
This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly
This is so we can reduce the amount of code and changes in rust-lang#159403. It should stand on its own, but really it's meant as an extended part of 159403.
This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly
This is so we can reduce the amount of code and changes in rust-lang#159403. It should stand on its own, but really it's meant as an extended part of 159403.
This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly
This is so we can reduce the amount of code and changes in rust-lang#159403. It should stand on its own, but really it's meant as an extended part of 159403.
This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
rust-borsBot pushed a commit that referenced this pull request Jul 28, 2026
…uwer
Rollup of 14 pull requests
Successful merges:
- #159990 (Many "predicate"-to-"clause" renamings)
- #159665 (Replace most `Ty::new_fn_def` calls with `type_of` queries directly)
- #159687 (rustdoc: Set tracing max_level_info when debug-logging is false)
- #160065 (Distinguish the dep-graph index space from the live node count)
- #159978 (run intrinsic-test by default on x86_64-gnu)
- #160008 (Avoid stale closure recovery state across statements)
- #160027 (Add regression test for #132767)
- #160030 (Update `browser-ui-test` version to `0.25.0`)
- #160046 (Improve consistency of attribute error messages (part 2))
- #160056 (Fix associated function suggestion for generic ADTs)
- #160069 (Update Rust crate tracing-subscriber to v0.3.23 [SECURITY])
- #160071 (sanitize_standard_fds: clarify macos comment)
- #160076 (use unstable features when updating dependencies)
- #160088 (fix 404 url in src/doc/rustdoc.md)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Jul 28, 2026
Replace most `Ty::new_fn_def` calls with `type_of` queries directly
This is so we can reduce the amount of code and changes in rust-lang#159403. It should stand on its own, but really it's meant as an extended part of 159403.
This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
This was referenced Jul 28, 2026
rust-borsBot pushed a commit that referenced this pull request Jul 28, 2026
…uwer
Rollup of 21 pull requests
Successful merges:
- #159990 (Many "predicate"-to-"clause" renamings)
- #159665 (Replace most `Ty::new_fn_def` calls with `type_of` queries directly)
- #159687 (rustdoc: Set tracing max_level_info when debug-logging is false)
- #160057 (refactor(mir-transform): Calculate optimization status inside `run_passes_inner`)
- #160060 (codegen: skip stores for entirely-uninit constant aggregate fields, attempt #2)
- #160063 (Fix ICE when dumping the dep graph with the parallel frontend)
- #160065 (Distinguish the dep-graph index space from the live node count)
- #158038 (Split register_tool into register_attribute_tool and register_lint_tool)
- #159776 (remove const hack in alloc)
- #159978 (run intrinsic-test by default on x86_64-gnu)
- #160008 (Avoid stale closure recovery state across statements)
- #160027 (Add regression test for #132767)
- #160030 (Update `browser-ui-test` version to `0.25.0`)
- #160046 (Improve consistency of attribute error messages (part 2))
- #160056 (Fix associated function suggestion for generic ADTs)
- #160069 (Update Rust crate tracing-subscriber to v0.3.23 [SECURITY])
- #160071 (sanitize_standard_fds: clarify macos comment)
- #160076 (use unstable features when updating dependencies)
- #160092 (miri ui tests: don't run native tests on stage 0)
- #160093 (Switch cargo assignments to weihanglo)
- #160094 (Update assignment for docs)
@rust-bors
rust-borsBot merged commit 1da9319 into rust-lang:mainJul 28, 2026
13 checks passed
@rustbotrustbot added this to the 1.99.0 milestone Jul 28, 2026
rust-timer added a commit that referenced this pull request Jul 28, 2026
Rollup merge of #159665 - addiesh:turbofish-fear-me, r=oli-obk
Replace most `Ty::new_fn_def` calls with `type_of` queries directly
This is so we can reduce the amount of code and changes in #159403. It should stand on its own, but really it's meant as an extended part of 159403.
This allows getting the right `ty::FnDef` even cross-crate, as the `type_of` query results are stored in metadata, in contrast to the queries for computing the binder for various declarations. These binders are already cached via `fn_sig`, but using that is somewhat overkill and can cause cycle errors in some cases.
pullBot pushed a commit to LeeeeeeM/miri that referenced this pull request Jul 29, 2026
…uwer
Rollup of 21 pull requests
Successful merges:
- rust-lang/rust#159990 (Many "predicate"-to-"clause" renamings)
- rust-lang/rust#159665 (Replace most `Ty::new_fn_def` calls with `type_of` queries directly)
- rust-lang/rust#159687 (rustdoc: Set tracing max_level_info when debug-logging is false)
- rust-lang/rust#160057 (refactor(mir-transform): Calculate optimization status inside `run_passes_inner`)
- rust-lang/rust#160060 (codegen: skip stores for entirely-uninit constant aggregate fields, attempt rust-lang/rust#2)
- rust-lang/rust#160063 (Fix ICE when dumping the dep graph with the parallel frontend)
- rust-lang/rust#160065 (Distinguish the dep-graph index space from the live node count)
- rust-lang/rust#158038 (Split register_tool into register_attribute_tool and register_lint_tool)
- rust-lang/rust#159776 (remove const hack in alloc)
- rust-lang/rust#159978 (run intrinsic-test by default on x86_64-gnu)
- rust-lang/rust#160008 (Avoid stale closure recovery state across statements)
- rust-lang/rust#160027 (Add regression test for rust-lang/rust#132767)
- rust-lang/rust#160030 (Update `browser-ui-test` version to `0.25.0`)
- rust-lang/rust#160046 (Improve consistency of attribute error messages (part 2))
- rust-lang/rust#160056 (Fix associated function suggestion for generic ADTs)
- rust-lang/rust#160069 (Update Rust crate tracing-subscriber to v0.3.23 [SECURITY])
- rust-lang/rust#160071 (sanitize_standard_fds: clarify macos comment)
- rust-lang/rust#160076 (use unstable features when updating dependencies)
- rust-lang/rust#160092 (miri ui tests: don't run native tests on stage 0)
- rust-lang/rust#160093 (Switch cargo assignments to weihanglo)
- rust-lang/rust#160094 (Update assignment for docs)
github-actionsBot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Aug 3, 2026
…uwer
Rollup of 21 pull requests
Successful merges:
- rust-lang/rust#159990 (Many "predicate"-to-"clause" renamings)
- rust-lang/rust#159665 (Replace most `Ty::new_fn_def` calls with `type_of` queries directly)
- rust-lang/rust#159687 (rustdoc: Set tracing max_level_info when debug-logging is false)
- rust-lang/rust#160057 (refactor(mir-transform): Calculate optimization status inside `run_passes_inner`)
- rust-lang/rust#160060 (codegen: skip stores for entirely-uninit constant aggregate fields, attempt rust-lang/rust#2)
- rust-lang/rust#160063 (Fix ICE when dumping the dep graph with the parallel frontend)
- rust-lang/rust#160065 (Distinguish the dep-graph index space from the live node count)
- rust-lang/rust#158038 (Split register_tool into register_attribute_tool and register_lint_tool)
- rust-lang/rust#159776 (remove const hack in alloc)
- rust-lang/rust#159978 (run intrinsic-test by default on x86_64-gnu)
- rust-lang/rust#160008 (Avoid stale closure recovery state across statements)
- rust-lang/rust#160027 (Add regression test for rust-lang/rust#132767)
- rust-lang/rust#160030 (Update `browser-ui-test` version to `0.25.0`)
- rust-lang/rust#160046 (Improve consistency of attribute error messages (part 2))
- rust-lang/rust#160056 (Fix associated function suggestion for generic ADTs)
- rust-lang/rust#160069 (Update Rust crate tracing-subscriber to v0.3.23 [SECURITY])
- rust-lang/rust#160071 (sanitize_standard_fds: clarify macos comment)
- rust-lang/rust#160076 (use unstable features when updating dependencies)
- rust-lang/rust#160092 (miri ui tests: don't run native tests on stage 0)
- rust-lang/rust#160093 (Switch cargo assignments to weihanglo)
- rust-lang/rust#160094 (Update assignment for docs)
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Aug 17, 2026
…uwer
Rollup of 21 pull requests
Successful merges:
- rust-lang/rust#159990 (Many "predicate"-to-"clause" renamings)
- rust-lang/rust#159665 (Replace most `Ty::new_fn_def` calls with `type_of` queries directly)
- rust-lang/rust#159687 (rustdoc: Set tracing max_level_info when debug-logging is false)
- rust-lang/rust#160057 (refactor(mir-transform): Calculate optimization status inside `run_passes_inner`)
- rust-lang/rust#160060 (codegen: skip stores for entirely-uninit constant aggregate fields, attempt rust-lang/rust#2)
- rust-lang/rust#160063 (Fix ICE when dumping the dep graph with the parallel frontend)
- rust-lang/rust#160065 (Distinguish the dep-graph index space from the live node count)
- rust-lang/rust#158038 (Split register_tool into register_attribute_tool and register_lint_tool)
- rust-lang/rust#159776 (remove const hack in alloc)
- rust-lang/rust#159978 (run intrinsic-test by default on x86_64-gnu)
- rust-lang/rust#160008 (Avoid stale closure recovery state across statements)
- rust-lang/rust#160027 (Add regression test for rust-lang/rust#132767)
- rust-lang/rust#160030 (Update `browser-ui-test` version to `0.25.0`)
- rust-lang/rust#160046 (Improve consistency of attribute error messages (part 2))
- rust-lang/rust#160056 (Fix associated function suggestion for generic ADTs)
- rust-lang/rust#160069 (Update Rust crate tracing-subscriber to v0.3.23 [SECURITY])
- rust-lang/rust#160071 (sanitize_standard_fds: clarify macos comment)
- rust-lang/rust#160076 (use unstable features when updating dependencies)
- rust-lang/rust#160092 (miri ui tests: don't run native tests on stage 0)
- rust-lang/rust#160093 (Switch cargo assignments to weihanglo)
- rust-lang/rust#160094 (Update assignment for docs)
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-borsStatus: Waiting on bors to run and complete tests. Bors will change the label on completion.T-compilerRelevant 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.

4 participants

@addiesh@rustbot@oli-obk@rust-timer