Skip to content

Create some minimal HIR for associated opaque types - #120943

Merged
bors merged 1 commit into
rust-lang:masterfrom
petrochenkov:somehir3
Mar 14, 2024
Merged

Create some minimal HIR for associated opaque types#120943
bors merged 1 commit into
rust-lang:masterfrom
petrochenkov:somehir3

Conversation

@petrochenkov

Copy link
Copy Markdown
Contributor

LocalDefIds for opaque types in traits and impls are created after AST -> HIR lowering, so they don't have corresponding HIR and return their various properties through fed queries.

In this PR I also feed some core HIR-related queries for these LocalDefIds (which happen to be HIR owners).
As a result all LocalDefIds now have corresponding HirIds and HIR nodes, and "optional" methods like opt_local_def_id_to_hir_id and opt_hir_node_by_def_id can be removed.

Follow up to #120206.

@rustbot

Copy link
Copy Markdown
Collaborator

r? @wesleywiser

rustbot has assigned @wesleywiser.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbotrustbot 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 Feb 11, 2024
@petrochenkov

Copy link
Copy Markdown
ContributorAuthor

@cjgillot@compiler-errors What do you think?

@compiler-errors

Copy link
Copy Markdown
Contributor

I can take a look at this later. My first reaction (having only vaguely skimmed the code) is that this makes sense, and I wonder if we can actually add more information into this feeded HIR to get rid of some opt_rpitit_info calls in queries.

r? compiler-errors

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

Makes sense. I think we'll be able to use the same scheme for other, similar situations where we want to create def ids and feed queries

Comment threadcompiler/rustc_middle/src/query/mod.rs Outdated
Comment threadcompiler/rustc_middle/src/ty/context.rs Outdated
@oli-obkoli-obk self-assigned this Feb 14, 2024
@petrochenkovpetrochenkov 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 Feb 26, 2024
@bors

This comment was marked as resolved.

@petrochenkovpetrochenkov changed the title [WIP] Create some minimal HIR for associated opaque typesCreate some minimal HIR for associated opaque typesMar 13, 2024
@petrochenkov

Copy link
Copy Markdown
ContributorAuthor

@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 Mar 13, 2024
@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Mar 13, 2024

Copy link
Copy Markdown
Collaborator

📌 Commit b6312eb has been approved by oli-obk

It is now in the queue for this repository.

@borsbors 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 Mar 13, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 13, 2024
Create some minimal HIR for associated opaque types
`LocalDefId`s for opaque types in traits and impls are created after AST -> HIR lowering, so they don't have corresponding HIR and return their various properties through fed queries.
In this PR I also feed some core HIR-related queries for these `LocalDefId`s (which happen to be HIR owners).
As a result all `LocalDefId`s now have corresponding `HirId`s and HIR nodes, and "optional" methods like `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id` can be removed.
Follow up to rust-lang#120206.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 13, 2024
Create some minimal HIR for associated opaque types
`LocalDefId`s for opaque types in traits and impls are created after AST -> HIR lowering, so they don't have corresponding HIR and return their various properties through fed queries.
In this PR I also feed some core HIR-related queries for these `LocalDefId`s (which happen to be HIR owners).
As a result all `LocalDefId`s now have corresponding `HirId`s and HIR nodes, and "optional" methods like `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id` can be removed.
Follow up to rust-lang#120206.
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 13, 2024
…iaskrgr
Rollup of 9 pull requests
Successful merges:
- rust-lang#104353 (Add CStr::bytes iterator)
- rust-lang#120699 (Document `TRACK_DIAGNOSTIC` calls.)
- rust-lang#120943 (Create some minimal HIR for associated opaque types)
- rust-lang#121764 (Make incremental sessions identity no longer depend on the crate names provided by source code)
- rust-lang#122375 (CFI: Break tests into smaller files)
- rust-lang#122397 (Various cleanups around the const eval query providers)
- rust-lang#122405 (Add methods to create StableMIR constant)
- rust-lang#122416 (Various style improvements to `rustc_lint::levels`)
- rust-lang#122440 (const-eval: organize and extend tests for required-consts)
r? `@ghost`
`@rustbot` modify labels: rollup
@bors

bors commented Mar 14, 2024

Copy link
Copy Markdown
Collaborator

⌛ Testing commit b6312eb with merge fe61575...

@bors

bors commented Mar 14, 2024

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing fe61575 to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Mar 14, 2024
@bors
bors merged commit fe61575 into rust-lang:masterMar 14, 2024
@rustbotrustbot added this to the 1.78.0 milestone Mar 14, 2024
@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (fe61575): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
0.8%[0.2%, 1.4%]2
Improvements ✅
(primary)
--0
Improvements ✅
(secondary)
--0
All ❌✅ (primary)--0

Max RSS (memory usage)

Results

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.

meanrangecount
Regressions ❌
(primary)
--0
Regressions ❌
(secondary)
3.9%[2.5%, 5.8%]4
Improvements ✅
(primary)
-2.5%[-2.5%, -2.5%]1
Improvements ✅
(secondary)
-4.5%[-5.2%, -3.9%]3
All ❌✅ (primary)-2.5%[-2.5%, -2.5%]1

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: 670.541s -> 669.602s (-0.14%)
Artifact size: 310.79 MiB -> 310.86 MiB (0.02%)

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Mar 15, 2024
hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`
Also replace a few `hir_node()` calls with `hir_node_by_def_id()`.
Follow up to rust-lang#120943.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Mar 15, 2024
Rollup merge of rust-lang#122513 - petrochenkov:somehir4, r=fmease
hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`
Also replace a few `hir_node()` calls with `hir_node_by_def_id()`.
Follow up to rust-lang#120943.
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Mar 21, 2024
hir: Remove `opt_local_def_id_to_hir_id` and `opt_hir_node_by_def_id`
Also replace a few `hir_node()` calls with `hir_node_by_def_id()`.
Follow up to rust-lang/rust#120943.
@petrochenkov
petrochenkov deleted the somehir3 branch February 22, 2025 18:28
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.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.

7 participants

@petrochenkov@rustbot@compiler-errors@bors@oli-obk@rust-timer@wesleywiser