Skip to content

rustc: hir().local_def_id_to_hir_id() -> tcx.local_def_id_to_hir_id() cleanup #118256

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

petrochenkov
Copy link
Contributor

Noticed this while working on #118188.

The history here is that the method was moved from HIR map to tcx in #93373 as a part of incremental compilation work, so it's unlikely to go back.

@rustbot
Copy link
Collaborator

rustbot commented Nov 24, 2023

r? @wesleywiser

(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 Nov 24, 2023
@rustbot
Copy link
Collaborator

rustbot commented Nov 24, 2023

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

Some changes might have occurred in exhaustiveness checking

cc @Nadrieril

Some changes occurred to the CTFE / Miri engine

cc @rust-lang/miri

The Miri subtree was changed

cc @rust-lang/miri

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in src/librustdoc/clean/types.rs

cc @camelid

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@compiler-errors
Copy link
Member

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 24, 2023

📌 Commit 27b5569 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-review Status: Awaiting review from the assignee but also interested parties. labels Nov 24, 2023
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 25, 2023
…llaumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#116446 (Yeet `mir::Const::from_anon_const`)
 - rust-lang#117871 (remove unused pub fns)
 - rust-lang#118017 (rustc_lint: address latent TODO)
 - rust-lang#118199 (Remove `HirId` from `QPath::LangItem`)
 - rust-lang#118272 (resolve: Avoid clones of `MacroData`)
 - rust-lang#118291 (rustdoc-search: clean up some DOM code)

Failed merges:

 - rust-lang#118201 (Miscellaneous `ObligationCauseCode` cleanups)
 - rust-lang#118256 (rustc: `hir().local_def_id_to_hir_id()` -> `tcx.local_def_id_to_hir_id()` cleanup)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors

This comment was marked as resolved.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 25, 2023
@petrochenkov
Copy link
Contributor Author

@bors r=compiler-errors

@bors
Copy link
Collaborator

bors commented Nov 25, 2023

📌 Commit dcff6f7 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 Nov 25, 2023
@petrochenkov
Copy link
Contributor Author

@cjgillot
What is the current purpose of hir::map::Map, actually?
From git history I see that it had more fields in the past, but eventually shrunk to just a wrapper around tcx.
Maybe it's no longer necessary at all?

@cjgillot
Copy link
Contributor

It's no longer necessary. I take it as a tool to namespace hir stuff, but that's quite weak a purpose.
If you want to sed away all the .hir(), I'll r+ it.

@compiler-errors
Copy link
Member

If we get rid of hir::Map and .hir(), we should also give most of the methods being moved new names. For example, tcx.hir().find(hir_id) -> tcx.find(hir_id) seems like it could be confusing.

@bors

This comment was marked as resolved.

@bors bors 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-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Nov 26, 2023
@petrochenkov
Copy link
Contributor Author

If we get rid of hir::Map and .hir(), we should also give most of the methods being moved new names. For example, tcx.hir().find(hir_id) -> tcx.find(hir_id) seems like it could be confusing.

If .hir() is removed most new names should probably have "hir" in them, like find -> find_hir_node.

@petrochenkov
Copy link
Contributor Author

@bors r=compiler-errors

@bors
Copy link
Collaborator

bors commented Nov 26, 2023

📌 Commit c697927 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 Nov 26, 2023
@bors
Copy link
Collaborator

bors commented Nov 26, 2023

⌛ Testing commit c697927 with merge 3acb261...

@bors
Copy link
Collaborator

bors commented Nov 26, 2023

☀️ Test successful - checks-actions
Approved by: compiler-errors
Pushing 3acb261 to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Nov 26, 2023
@bors bors merged commit 3acb261 into rust-lang:master Nov 26, 2023
@rustbot rustbot added this to the 1.76.0 milestone Nov 26, 2023
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (3acb261): comparison URL.

Overall result: no relevant changes - no action needed

@rustbot label: -perf-regression

Instruction count

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

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)
4.2% [4.2%, 4.2%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.5% [-4.5%, -4.5%] 1
All ❌✅ (primary) - - 0

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: 675.337s -> 675.058s (-0.04%)
Artifact size: 313.38 MiB -> 313.35 MiB (-0.01%)

celinval added a commit to model-checking/kani that referenced this pull request Nov 27, 2023
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 12, 2023
…trochenkov

Move some methods from `tcx.hir()` to `tcx`

rust-lang#118256 (comment)

Renamed:
- find -> opt_hir_node
- get -> hir_node
- find_by_def_id -> opt_hir_node_by_def_id
- get_by_def_id -> hir_node_by_def_id
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 13, 2023
…ochenkov

Move some methods from `tcx.hir()` to `tcx`

rust-lang#118256 (comment)

Renamed:
- find -> opt_hir_node
- get -> hir_node
- find_by_def_id -> opt_hir_node_by_def_id
- get_by_def_id -> hir_node_by_def_id
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Dec 14, 2023
Move some methods from `tcx.hir()` to `tcx`

rust-lang/rust#118256 (comment)

Renamed:
- find -> opt_hir_node
- get -> hir_node
- find_by_def_id -> opt_hir_node_by_def_id
- get_by_def_id -> hir_node_by_def_id
@petrochenkov petrochenkov deleted the nohir branch February 22, 2025 18:29
# for free to join this conversation on GitHub. Already have an account? # 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. 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.

7 participants