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

Move methods from Map to TyCtxt, part 4. #137504

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

nnethercote
Copy link
Contributor

A follow-up to #137350.

r? @Zalathar

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide 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 Feb 24, 2025
@rustbot
Copy link
Collaborator

rustbot commented Feb 24, 2025

Some changes occurred in match checking

cc @Nadrieril

The rustc-dev-guide subtree was changed. If this PR only touches the dev guide consider submitting a PR directly to rust-lang/rustc-dev-guide otherwise thank you for updating the dev guide with your changes.

cc @BoxyUwU, @jieyouxu, @Kobzol

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann

Some changes occurred to the CTFE machinery

cc @rust-lang/wg-const-eval

Some changes occurred in need_type_info.rs

cc @lcnr

HIR ty lowering was modified

cc @fmease

Some changes occurred in compiler/rustc_codegen_ssa/src/codegen_attrs.rs

cc @jdonszelmann

@bors
Copy link
Contributor

bors commented Feb 25, 2025

☔ The latest upstream changes (presumably #135726) made this pull request unmergeable. Please resolve the merge conflicts.

@Zalathar
Copy link
Contributor

Zalathar commented Mar 1, 2025

Feedback: From the perspective of reviewing bulk changes, I would prefer not to have things like the inlining/renaming of node_to_string in the same PR, even in a separate patch, unless absolutely necessary.

(Partly because it expands the scope of the review to include non-trivial changes, and partly because many-file PRs make GitHub very slow in ways that make me want to avoid any other kind of review friction.)

@nnethercote nnethercote changed the title Move methods from Map to TyCtxt, part 4. #137350 Move methods from Map to TyCtxt, part 4. Mar 2, 2025
@nnethercote
Copy link
Contributor Author

Huh.

So this is part 4 of my work to get rid of Map. Even though getting rid of Map is conceptually a single change, I've split it across multiple PRs because I didn't want to move every method at once, because that would create enormous diffs that are hard to review.

And in this PR I could have just renamed node_to_string as hir_node_to_string and left it as a trivial wrapper for hir_id_to_string. But in #136466 when I left hir_krate as a trivial wrapper around hir_crate cjgillot suggested that I remove it. Which I did in a separate commit. So I figured I would do the same here, and as part of the change I moved node_to_string into a method because it was odd having it as a free function when everything else is methods. And I put it in its own commit because it's slightly different to the mass renamings, to make it easier to review. Much like I did with the query renaming.

IIUC, you would have preferred me to leave the trivial wrapper in place and remove it in a separate PR, because that would make reviewing easier. Is that right?

@Zalathar
Copy link
Contributor

Zalathar commented Mar 2, 2025

IIUC, you would have preferred me to leave the trivial wrapper in place and remove it in a separate PR, because that would make reviewing easier. Is that right?

That's right.

For context, my workflow for reviewing these renamings has been to scroll through the list of changes, look at each change and say “that's trivial”, and then mark the file as viewed in the GitHub review UI. That UI for marking files doesn't work properly when viewing individual commits, which is why splitting off a separate commit didn't help in this case, even though it's normally a good idea.

So for a bulk-renaming PR like this, my approach as an author would have been to avoid any complication that isn't absolutely necessary (with hir_attr_map being a good example of a necessary change), especially since the overall migration is being split across several PRs anyway.

@nnethercote
Copy link
Contributor Author

Huh, I've never noticed that the per-commit view lacks the "viewed" checkbox. Probably because I just click on the chevron in the top left if I've finished reviewing a file. That collapses it, just like clicking on the "viewed" checkbox does.

@rustbot
Copy link
Collaborator

rustbot commented Mar 4, 2025

Some changes occurred to constck

cc @fee1-dead

@nnethercote
Copy link
Contributor Author

I rebased and fixed the broken link in the guide.

@rust-log-analyzer

This comment has been minimized.

@nnethercote
Copy link
Contributor Author

Updated again to fix the compile errors.

@nnethercote
Copy link
Contributor Author

@Zalathar: any other changes needed here?

@Zalathar
Copy link
Contributor

Ah sorry, I lost track of this. I'll have another look at it today.

@Zalathar
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 11, 2025

📌 Commit 1047768 has been approved by Zalathar

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 11, 2025
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Mar 11, 2025
Move methods from Map to TyCtxt, part 4.

A follow-up to rust-lang#137350.

r? `@Zalathar`
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2025
Rollup of 18 pull requests

Successful merges:

 - rust-lang#126856 (remove deprecated tool `rls`)
 - rust-lang#137314 (change definitely unproductive cycles to error)
 - rust-lang#137504 (Move methods from Map to TyCtxt, part 4.)
 - rust-lang#137701 (Convert `ShardedHashMap` to use `hashbrown::HashTable`)
 - rust-lang#137967 ([AIX] Fix hangs during testing)
 - rust-lang#138002 (Disable CFI for weakly linked syscalls)
 - rust-lang#138052 (strip `-Wlinker-messages` wrappers from `rust-lld` rmake test)
 - rust-lang#138063 (Improve `-Zunpretty=hir` for parsed attrs)
 - rust-lang#138109 (make precise capturing args in rustdoc Json typed)
 - rust-lang#138147 (Add maintainers for powerpc64le-unknown-linux-gnu)
 - rust-lang#138245 (stabilize `ci_rustc_if_unchanged_logic` test for local environments)
 - rust-lang#138296 (Remove `AdtFlags::IS_ANONYMOUS` and `Copy`/`Clone` condition for anonymous ADT)
 - rust-lang#138300 (add tracking issue for unqualified_local_imports)
 - rust-lang#138307 (Allow specifying glob patterns for try jobs)
 - rust-lang#138313 (Update books)
 - rust-lang#138315 (use next_back() instead of last() on DoubleEndedIterator)
 - rust-lang#138318 (Rustdoc: remove a bunch of `@ts-expect-error` from main.js)
 - rust-lang#138330 (Remove unnecessary `[lints.rust]` sections.)

Failed merges:

 - rust-lang#137147 (Add exclude to config.toml)

r? `@ghost`
`@rustbot` modify labels: rollup
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Mar 11, 2025
Move methods from Map to TyCtxt, part 4.

A follow-up to rust-lang#137350.

r? ``@Zalathar``
@matthiaskrgr
Copy link
Member

@bors r-
need rebase I think

@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 Mar 11, 2025
@matthiaskrgr
Copy link
Member

@bors try

@bors
Copy link
Contributor

bors commented Mar 11, 2025

⌛ Trying commit 1047768 with merge 8becda10ff5df6b1ec2906c25213890fcd1921dd...

bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 11, 2025
Move methods from Map to TyCtxt, part 4.

A follow-up to rust-lang#137350.

r? `@Zalathar`
@bors
Copy link
Contributor

bors commented Mar 11, 2025

☀️ Try build successful - checks-actions
Build commit: 8becda1 (8becda10ff5df6b1ec2906c25213890fcd1921dd)

`Map::node_to_string` just calls the free function `hir_id_to_string`.
This commit removes the former and changes the latter into a `TyCtxt`
method.
To make room for the moving of `Map::attrs` to `TyCtxt::hir_attrs` in
the next commit. (It makes sense to rename the query, because it has
many fewer uses than the method.)
Continuing the work from rust-lang#137350.

Removes the unused methods: `expect_variant`, `expect_field`,
`expect_foreign_item`.

Every method gains a `hir_` prefix.
@rustbot
Copy link
Collaborator

rustbot commented Mar 11, 2025

Some changes occurred in compiler/rustc_codegen_ssa

cc @WaffleLapkin

@nnethercote
Copy link
Contributor Author

I rebased.

@bors r=Zalathar

@bors
Copy link
Contributor

bors commented Mar 11, 2025

📌 Commit 256c27e has been approved by Zalathar

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 Mar 11, 2025
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Mar 12, 2025
Move methods from Map to TyCtxt, part 4.

A follow-up to rust-lang#137350.

r? `@Zalathar`
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Mar 12, 2025
Move methods from Map to TyCtxt, part 4.

A follow-up to rust-lang#137350.

r? ``@Zalathar``
bors added a commit to rust-lang-ci/rust that referenced this pull request Mar 12, 2025
Rollup of 25 pull requests

Successful merges:

 - rust-lang#134076 (Stabilize `std::io::ErrorKind::InvalidFilename`)
 - rust-lang#136842 (Add libstd support for Trusty targets)
 - rust-lang#137314 (change definitely unproductive cycles to error)
 - rust-lang#137504 (Move methods from Map to TyCtxt, part 4.)
 - rust-lang#137621 (Add std support to cygwin target)
 - rust-lang#137701 (Convert `ShardedHashMap` to use `hashbrown::HashTable`)
 - rust-lang#138109 (make precise capturing args in rustdoc Json typed)
 - rust-lang#138161 (Add PeekMut::refresh)
 - rust-lang#138162 (Update the standard library to Rust 2024)
 - rust-lang#138174 (Elaborate trait assumption in `receiver_is_dispatchable`)
 - rust-lang#138175 (Support rmeta inputs for --crate-type=bin --emit=obj)
 - rust-lang#138269 (uefi: fs: Implement FileType, FilePermissions and FileAttr)
 - rust-lang#138313 (Update books)
 - rust-lang#138318 (Rustdoc: remove a bunch of `@ts-expect-error` from main.js)
 - rust-lang#138331 (Use `RUSTC_LINT_FLAGS` more)
 - rust-lang#138333 (Rebuild llvm spuriously less frequently)
 - rust-lang#138343 (Enable `f16` tests for `powf`)
 - rust-lang#138345 (Some autodiff cleanups)
 - rust-lang#138346 (naked functions: on windows emit `.endef` without the symbol name)
 - rust-lang#138347 (Reduce `kw::Empty` usage, part 2)
 - rust-lang#138360 (Fix false-positive in `expr_or_init` and in the `invalid_from_utf8` lint)
 - rust-lang#138371 (Update compiletest's `has_asm_support` to match rustc)
 - rust-lang#138372 (Refactor `pick2_mut` & `pick3_mut` to use `get_disjoint_mut`)
 - rust-lang#138376 (Item-related cleanups)
 - rust-lang#138377 (Remove unnecessary lifetime from `PatInfo`.)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-attributes Area: Attributes (`#[…]`, `#![…]`) A-rustc-dev-guide Area: rustc-dev-guide 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.

6 participants