Skip to content
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

Create some minimal HIR for associated opaque types #120943

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

petrochenkov
Copy link
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
Collaborator

rustbot commented Feb 11, 2024

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

@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 Feb 11, 2024
@petrochenkov
Copy link
Contributor Author

@cjgillot @compiler-errors What do you think?

@compiler-errors
Copy link
Member

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

Copy link
Contributor

@oli-obk oli-obk left a comment

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

compiler/rustc_middle/src/query/mod.rs Outdated Show resolved Hide resolved
compiler/rustc_middle/src/ty/context.rs Outdated Show resolved Hide resolved
@oli-obk oli-obk self-assigned this Feb 14, 2024
@petrochenkov petrochenkov 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.

@petrochenkov petrochenkov changed the title [WIP] Create some minimal HIR for associated opaque types Create some minimal HIR for associated opaque types Mar 13, 2024
@petrochenkov
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot 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
Contributor

oli-obk commented Mar 13, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Mar 13, 2024

📌 Commit b6312eb 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 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
Copy link
Contributor

bors commented Mar 14, 2024

⌛ Testing commit b6312eb with merge fe61575...

@bors
Copy link
Contributor

bors commented Mar 14, 2024

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

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Mar 14, 2024
@bors bors merged commit fe61575 into rust-lang:master Mar 14, 2024
12 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Mar 14, 2024
@rust-timer
Copy link
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.

mean range count
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.

mean range count
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.
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.

7 participants