-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
Start removing rustc_middle::hir::map::Map
#136466
Conversation
Some changes occurred in compiler/rustc_codegen_cranelift cc @bjorn3 changes to the core type system Some changes occurred in src/tools/clippy cc @rust-lang/clippy 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 coverage instrumentation. cc @Zalathar Some changes occurred in match checking cc @Nadrieril Some changes occurred to MIR optimizations cc @rust-lang/wg-mir-opt HIR ty lowering was modified cc @fmease Some changes occurred in need_type_info.rs cc @lcnr |
There are a lot more methods to move from |
d69210d
to
14d4561
Compare
This comment has been minimized.
This comment has been minimized.
14d4561
to
90a871b
Compare
This comment has been minimized.
This comment has been minimized.
90a871b
to
2ed2d93
Compare
This comment has been minimized.
This comment has been minimized.
☔ The latest upstream changes (presumably #136549) made this pull request unmergeable. Please resolve the merge conflicts. |
2ed2d93
to
f5383a1
Compare
This comment has been minimized.
This comment has been minimized.
f5383a1
to
daae919
Compare
This comment has been minimized.
This comment has been minimized.
daae919
to
1a5cfbd
Compare
Note: this comment is the one that identified that |
☔ The latest upstream changes (presumably #136613) made this pull request unmergeable. Please resolve the merge conflicts. |
1a5cfbd
to
d926427
Compare
Some changes occurred in compiler/rustc_passes/src/check_attr.rs |
I rebased. This PR is conflict-prone. |
☔ The latest upstream changes (presumably #136878) made this pull request unmergeable. Please resolve the merge conflicts. |
The conflicts are trivial and won't affect review, so I will wait before fixing them. |
The `Map` trait is there for cases where `tcx` isn't available. This isn't one of those cases, so it's simpler to just call through `tcx` directly.
d926427
to
590b39e
Compare
It's been two weeks, let's try a different reviewer. I have rebased to fix the conflicts. r? Zalathar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for cleaning this up.
2 nits and r=me
The end goal is to eliminate `Map` altogether. I added a `hir_` prefix to all of them, that seemed simplest. The exceptions are `module_items` which became `hir_module_free_items` because there was already a `hir_module_items`, and `items` which became `hir_free_items` for consistency with `hir_module_free_items`.
First of all, note that `Map` has three different relevant meanings. - The `intravisit::Map` trait. - The `map::Map` struct. - The `NestedFilter::Map` associated type. The `intravisit::Map` trait is impl'd twice. - For `!`, where the methods are all unreachable. - For `map::Map`, which gets HIR stuff from the `TyCtxt`. As part of getting rid of `map::Map`, this commit changes `impl intravisit::Map for map::Map` to `impl intravisit::Map for TyCtxt`. It's fairly straightforward except various things are renamed, because the existing names would no longer have made sense. - `trait intravisit::Map` becomes `trait intravisit::HirTyCtxt`, so named because it gets some HIR stuff from a `TyCtxt`. - `NestedFilter::Map` assoc type becomes `NestedFilter::MaybeTyCtxt`, because it's always `!` or `TyCtxt`. - `Visitor::nested_visit_map` becomes `Visitor::maybe_tcx`. I deliberately made the new trait and associated type names different to avoid the old `type Map: Map` situation, which I found confusing. We now have `type MaybeTyCtxt: HirTyCtxt`.
It's a trivial wrapper around the `hir_crate` query with a small number of uses.
590b39e
to
f666361
Compare
I fixed the nits. @bors r=cjgillot |
Continuing the work started in rust-lang#136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
Continuing the work started in rust-lang#136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
…iaskrgr Rollup of 7 pull requests Successful merges: - rust-lang#136466 (Start removing `rustc_middle::hir::map::Map`) - rust-lang#136671 (Overhaul `rustc_middle::limits`) - rust-lang#136817 (Pattern Migration 2024: clean up and comment) - rust-lang#136844 (Use `const_error!` when possible) - rust-lang#137080 (bootstrap: add more tracing to compiler/std/llvm flows) - rust-lang#137101 (`invalid_from_utf8[_unchecked]`: also lint inherent methods) - rust-lang#137140 (Fix const items not being allowed to be called `r#move` or `r#static`) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#136466 - nnethercote:start-removing-Map, r=cjgillot Start removing `rustc_middle::hir::map::Map` `rustc_middle::hir::map::Map` is now just a low-value wrapper around `TyCtxt`. This PR starts removing it. r? `@cjgillot`
Continuing the work started in rust-lang#136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
Move methods from `Map` to `TyCtxt`, part 2. Continuing the work started in rust-lang#136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that. r? Zalathar
Move methods from `Map` to `TyCtxt`, part 2. Continuing the work started in rust-lang#136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that. r? Zalathar
Continuing the work started in rust-lang#136466. Every method gains a `hir_` prefix, though for the ones that already have a `par_` or `try_par_` prefix I added the `hir_` after that.
Upstream PRs requiring changes: rust-lang/rust#135994 rust-lang/rust#136466 By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 and MIT licenses.
rustc_middle::hir::map::Map
is now just a low-value wrapper aroundTyCtxt
. This PR starts removing it.r? @cjgillot