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

hir: Make sure all HirIds have corresponding HIR Nodes #120206

Merged
merged 3 commits into from
Feb 8, 2024

Conversation

petrochenkov
Copy link
Contributor

And then remove tcx.opt_hir_node(hir_id) in favor of tcx.hir_node(hir_id).

@rustbot
Copy link
Collaborator

rustbot commented Jan 21, 2024

r? @davidtwco

(rustbot has picked a reviewer for you, use r? to override)

@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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Jan 21, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jan 21, 2024

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@compiler-errors
Copy link
Member

this is great!

perf run just to check 🤷, but i'll honestly probably approve this even if there is a minimal perf hit

@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 Jan 21, 2024
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2024
hir: Make sure all `HirId`s have corresponding HIR `Node`s

And then remove `tcx.opt_hir_node(hir_id)` in favor of `tcx.hir_node(hir_id)`.
@bors
Copy link
Contributor

bors commented Jan 21, 2024

⌛ Trying commit f26f870 with merge 21fc882...

@bors
Copy link
Contributor

bors commented Jan 21, 2024

☀️ Try build successful - checks-actions
Build commit: 21fc882 (21fc88249b233ad0825d9a3df1d0893f2c5400ed)

@rust-timer

This comment has been minimized.

@rust-timer
Copy link
Collaborator

Finished benchmarking commit (21fc882): comparison URL.

Overall result: no relevant changes - 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 benchmark run did not return any relevant results for this metric.

Max RSS (memory usage)

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

Cycles

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)
2.7% [2.5%, 3.0%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Binary size

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

Bootstrap: 663.041s -> 663.48s (0.07%)
Artifact size: 308.37 MiB -> 308.33 MiB (-0.01%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jan 21, 2024
compiler/rustc_ast_lowering/src/index.rs Outdated Show resolved Hide resolved
compiler/rustc_ast_lowering/src/index.rs Outdated Show resolved Hide resolved
#[allow(rustc::pass_by_value)]
ArrayLenInfer(&'hir Span),
#[allow(rustc::pass_by_value)]
Err(&'hir Span),
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we really need to store that span? Could we return DUMMY_SP when needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could return DUMMY_SP, yes.
index_hir just has a close enough real span that can be used, so I used it (that makes Node::span always return real spans).

compiler/rustc_hir/src/hir.rs Show resolved Hide resolved
compiler/rustc_hir/src/hir.rs Outdated Show resolved Hide resolved
@petrochenkov

This comment was marked as resolved.

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

TODO: Also need to check whether these HirIds could be removed instead, maybe they are not really necessary and were added by mistake.

The HirId in Let turned out to be unnecessary, other HirIds from this PR are used in more substantial ways.
Blocked on #120428.
@rustbot blocked

@rustbot rustbot added S-blocked Status: Blocked on something else such as an RFC or other implementation work. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 27, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jan 28, 2024
…errors

hir: Two preparatory changes for rust-lang#120206

cc rust-lang#120206
r? `@compiler-errors`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#120358 (Bump Fuchsia, build tests, and use 8 core bots)
 - rust-lang#120402 (Make the coroutine def id of an async closure the child of the closure def id)
 - rust-lang#120420 (Stop using derivative in rustc_pattern_analysis)
 - rust-lang#120425 (Remove unnecessary unit returns in query declarations)
 - rust-lang#120428 (hir: Two preparatory changes for rust-lang#120206)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 28, 2024
…iaskrgr

Rollup of 5 pull requests

Successful merges:

 - rust-lang#120358 (Bump Fuchsia, build tests, and use 8 core bots)
 - rust-lang#120402 (Make the coroutine def id of an async closure the child of the closure def id)
 - rust-lang#120420 (Stop using derivative in rustc_pattern_analysis)
 - rust-lang#120425 (Remove unnecessary unit returns in query declarations)
 - rust-lang#120428 (hir: Two preparatory changes for rust-lang#120206)

r? `@ghost`
`@rustbot` modify labels: rollup
@petrochenkov
Copy link
Contributor Author

@bors r=compiler-errors

@bors
Copy link
Contributor

bors commented Feb 7, 2024

📌 Commit 3e8c8d8 has been approved by compiler-errors

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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Feb 7, 2024
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 7, 2024
…rrors

hir: Make sure all `HirId`s have corresponding HIR `Node`s

And then remove `tcx.opt_hir_node(hir_id)` in favor of `tcx.hir_node(hir_id)`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 7, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#119592 (resolve: Unload speculatively resolved crates before freezing cstore)
 - rust-lang#120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation)
 - rust-lang#120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s)
 - rust-lang#120214 (match lowering: consistently lower bindings deepest-first)
 - rust-lang#120596 ([rustdoc] Correctly generate path for non-local items in source code pages)
 - rust-lang#120688 (GVN: also turn moves into copies with projections)
 - rust-lang#120702 (docs: also check the inline stmt during redundant link check)
 - rust-lang#120739 (improve pretty printing for associated items in trait objects)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2024
…iaskrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#119592 (resolve: Unload speculatively resolved crates before freezing cstore)
 - rust-lang#120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation)
 - rust-lang#120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s)
 - rust-lang#120214 (match lowering: consistently lower bindings deepest-first)
 - rust-lang#120596 ([rustdoc] Correctly generate path for non-local items in source code pages)
 - rust-lang#120688 (GVN: also turn moves into copies with projections)
 - rust-lang#120702 (docs: also check the inline stmt during redundant link check)
 - rust-lang#120739 (improve pretty printing for associated items in trait objects)

r? `@ghost`
`@rustbot` modify labels: rollup
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Feb 8, 2024
hir: Stop keeping prefixes for most of `use` list stems

And make sure all other imports have non-empty resolution lists.

Addresses one of FIXMEs in rust-lang/rust#120206.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 8, 2024
…rrors

hir: Make sure all `HirId`s have corresponding HIR `Node`s

And then remove `tcx.opt_hir_node(hir_id)` in favor of `tcx.hir_node(hir_id)`.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#119592 (resolve: Unload speculatively resolved crates before freezing cstore)
 - rust-lang#120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation)
 - rust-lang#120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s)
 - rust-lang#120214 (match lowering: consistently lower bindings deepest-first)
 - rust-lang#120596 ([rustdoc] Correctly generate path for non-local items in source code pages)
 - rust-lang#120688 (GVN: also turn moves into copies with projections)
 - rust-lang#120727 (exhaustiveness: Prefer "`0..MAX` not covered" to "`_` not covered")
 - rust-lang#120734 (Add `SubdiagnosticMessageOp` as a trait alias.)
 - rust-lang#120739 (improve pretty printing for associated items in trait objects)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#119592 (resolve: Unload speculatively resolved crates before freezing cstore)
 - rust-lang#120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation)
 - rust-lang#120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s)
 - rust-lang#120214 (match lowering: consistently lower bindings deepest-first)
 - rust-lang#120688 (GVN: also turn moves into copies with projections)
 - rust-lang#120702 (docs: also check the inline stmt during redundant link check)
 - rust-lang#120727 (exhaustiveness: Prefer "`0..MAX` not covered" to "`_` not covered")
 - rust-lang#120734 (Add `SubdiagnosticMessageOp` as a trait alias.)
 - rust-lang#120739 (improve pretty printing for associated items in trait objects)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit bf2ba86 into rust-lang:master Feb 8, 2024
11 checks passed
@rustbot rustbot added this to the 1.78.0 milestone Feb 8, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 8, 2024
Rollup merge of rust-lang#120206 - petrochenkov:somehir, r=compiler-errors

hir: Make sure all `HirId`s have corresponding HIR `Node`s

And then remove `tcx.opt_hir_node(hir_id)` in favor of `tcx.hir_node(hir_id)`.
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 11, 2024
hir: Refactor getters for HIR parents

See individual commits.

I ended up removing on of the FIXMEs from rust-lang#120206 instead of addressing it.
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Feb 12, 2024
Rollup merge of rust-lang#120872 - petrochenkov:opthirpar, r=cjgillot

hir: Refactor getters for HIR parents

See individual commits.

I ended up removing on of the FIXMEs from rust-lang#120206 instead of addressing it.
flip1995 pushed a commit to flip1995/rust that referenced this pull request Feb 26, 2024
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#119592 (resolve: Unload speculatively resolved crates before freezing cstore)
 - rust-lang#120103 (Make it so that async-fn-in-trait is compatible with a concrete future in implementation)
 - rust-lang#120206 (hir: Make sure all `HirId`s have corresponding HIR `Node`s)
 - rust-lang#120214 (match lowering: consistently lower bindings deepest-first)
 - rust-lang#120688 (GVN: also turn moves into copies with projections)
 - rust-lang#120702 (docs: also check the inline stmt during redundant link check)
 - rust-lang#120727 (exhaustiveness: Prefer "`0..MAX` not covered" to "`_` not covered")
 - rust-lang#120734 (Add `SubdiagnosticMessageOp` as a trait alias.)
 - rust-lang#120739 (improve pretty printing for associated items in trait objects)

r? `@ghost`
`@rustbot` modify labels: rollup
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 14, 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/miri that referenced this pull request Mar 15, 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/rust#120206.
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. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants