Start cutting down rustc_query_system#152160
Start cutting down rustc_query_system#152160nnethercote wants to merge 3 commits intorust-lang:mainfrom
rustc_query_system#152160Conversation
That's the only place it's used, so it no longer needs to be `pub`.
Instead of writing it by hand.
…umbing`. We are in the process of eliminating `rustc_query_system`. Chunks of it are unused by `rustc_middle`, and so can be moved into `rustc_query_info`. This commit does some of that. Mostly it's just moving code from one file to another. There are a couple of non-trivial changes. - `QueryState` and `ActiveKeyStatus` must remain in `rustc_query_system` because they are used by `rustc_middle`. But their inherent methods are not used by `rustc_middle`. So these methods are moved and converted to free functions. - The visibility of some things must increase. This includes `DepGraphData` and some of its methods, which are now used in `rustc_query_impl`. This is a bit annoying but seems hard to avoid. What little is left behind in `compiler/rustc_query_system/src/query/plumbing.rs` will be able to moved into `rustc_query_impl` or `rustc_middle` in the future.
|
I'd prefer to apply the |
|
You can't move the entire file. Some parts of it are used by |
|
Not enough moved for git to pick up a rename? It could be moved to a |
|
Adding a few hundred more lines to I'm not sure whether this will work out in practice, but here's a potential approach:
That would produce an end result similar to the current state of this PR, but with the migrated code still in its own separate file, and preserving as much line history as possible. |
|
The job Click to see the possible cause of the failure (guessed by this bot) |
Why? The same few hundred lines are removed from
It would also result in an odd module structure that reflects historical evolution rather than what makes sense today. |
|
☔ The latest upstream changes (presumably #152156) made this pull request unmergeable. Please resolve the merge conflicts. |
|
I tried prototyping my proposal, and while I still like it on paper, I came away with the distinct impression that it's probably not better enough to justify the extra fiddling and delay, compared to just moving forward with this PR. Ultimately, what's most important is unlocking the sorts of simplification and improvement that are impossible with the current module split. |
The query system is implemented in
rustc_query_system,rustc_middle, andrustc_query_impl.rustc_query_systemis hamstrung by not having access toTyCtxt, and there seems to be consensus to eliminate it. It's contents can be moved into the other two crates. Moving as much stuff as possible torustc_query_implis preferred, becauserustc_middleis already so big.This PR starts this process. It moves one small function to
rustc_middleand a good chunk of code torustc_query_impl.Once
rustc_query_systemis gone (or at least shrunk down a lot more) some of the traits likeDepContext,QueryContext, andQueryDispatcherwill be removable.r? @Zalathar