Minor structural improvements#151474
Conversation
|
The background here is I saw this blog post: https://pdh11.blogspot.com/2024/09/rust-circular-dependencies.html. It provides a script built on top of cargo-modules that identifies circular dependencies between modules. I tried it on the compiler and there are bazillions of what I think are harmless circular dependencies. E.g. it's very common for a crate root module to define lots of basic types, and then a submodule to use one or more of those types. Nonetheless, when I was looking through the generated dependency graphs I did notice a few suboptimal file layout things, which this PR fixes. |
This comment has been minimized.
This comment has been minimized.
It contains the `Cursor` type and an `impl Cursor` block with a few methods. But there is a larger `impl Cursor` block in the crate root. The only other thing in the `cursor` module is the simple `FrontmatterAllowed` type. So this commit just moves everything in the `cursor` module (which isn't much) into the crate root.
Every diagnostic struct in `rustc_parse` is in the `errors` module, except for `ForbiddenLetReason` and `MisspelledKw`. There's no good reason for this, and presumably it is just an accidental inconsistency. This commit moves them into `errors`.
From the `parser` module to the `errors` module, which is where most of its uses are. This means the `errors` module no longer depends on the `parser` module, removing a cyclic dependency between the two modules.
93f7de1 to
b33fdb2
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
@bors r+ rollup |
Minor structural improvements Some small cleanups. r? @davidtwco
…uwer Rollup of 9 pull requests Successful merges: - #151278 (Provide more context on trait bounds being unmet due to imperfect derive) - #151955 (escape symbol names in global asm) - #149329 (Mark match arms in try and for as being from desugarings.) - #151474 (Minor structural improvements) - #151744 (fix refining_impl_trait suggestion with return_type_notation) - #152107 (Convert to inline diagnostics in `rustc_borrowck`) - #152117 (Convert to inline diagnostics in `rustc_trait_selection`) - #152136 (Consolidate type const checks on `tcx.is_type_const`) - #152170 (Port `rustc_effective_visibility` to the new attribute parser)
…uwer Rollup of 9 pull requests Successful merges: - #151278 (Provide more context on trait bounds being unmet due to imperfect derive) - #151955 (escape symbol names in global asm) - #149329 (Mark match arms in try and for as being from desugarings.) - #151474 (Minor structural improvements) - #151744 (fix refining_impl_trait suggestion with return_type_notation) - #152107 (Convert to inline diagnostics in `rustc_borrowck`) - #152117 (Convert to inline diagnostics in `rustc_trait_selection`) - #152136 (Consolidate type const checks on `tcx.is_type_const`) - #152170 (Port `rustc_effective_visibility` to the new attribute parser)
Minor structural improvements Some small cleanups. r? @davidtwco
…uwer Rollup of 11 pull requests Successful merges: - #152174 (stdarch subtree update) - #151278 (Provide more context on trait bounds being unmet due to imperfect derive) - #151955 (escape symbol names in global asm) - #149329 (Mark match arms in try and for as being from desugarings.) - #151474 (Minor structural improvements) - #151744 (fix refining_impl_trait suggestion with return_type_notation) - #152107 (Convert to inline diagnostics in `rustc_borrowck`) - #152117 (Convert to inline diagnostics in `rustc_trait_selection`) - #152136 (Consolidate type const checks on `tcx.is_type_const`) - #152170 (Port `rustc_effective_visibility` to the new attribute parser) - #152184 (Port rustc_abi to the attribute parser)
…uwer Rollup of 11 pull requests Successful merges: - #152174 (stdarch subtree update) - #151278 (Provide more context on trait bounds being unmet due to imperfect derive) - #151955 (escape symbol names in global asm) - #149329 (Mark match arms in try and for as being from desugarings.) - #151474 (Minor structural improvements) - #151744 (fix refining_impl_trait suggestion with return_type_notation) - #152107 (Convert to inline diagnostics in `rustc_borrowck`) - #152117 (Convert to inline diagnostics in `rustc_trait_selection`) - #152136 (Consolidate type const checks on `tcx.is_type_const`) - #152170 (Port `rustc_effective_visibility` to the new attribute parser) - #152184 (Port rustc_abi to the attribute parser)
…uwer Rollup of 11 pull requests Successful merges: - #152174 (stdarch subtree update) - #151278 (Provide more context on trait bounds being unmet due to imperfect derive) - #151955 (escape symbol names in global asm) - #149329 (Mark match arms in try and for as being from desugarings.) - #151474 (Minor structural improvements) - #151744 (fix refining_impl_trait suggestion with return_type_notation) - #152107 (Convert to inline diagnostics in `rustc_borrowck`) - #152117 (Convert to inline diagnostics in `rustc_trait_selection`) - #152136 (Consolidate type const checks on `tcx.is_type_const`) - #152170 (Port `rustc_effective_visibility` to the new attribute parser) - #152184 (Port rustc_abi to the attribute parser)
Minor structural improvements Some small cleanups. r? @davidtwco
Minor structural improvements Some small cleanups. r? @davidtwco
…uwer Rollup of 13 pull requests Successful merges: - #152191 (Convert to inline diagnostics in `rustc_hir_analysis`) - #149329 (Mark match arms in try and for as being from desugarings.) - #151474 (Minor structural improvements) - #152107 (Convert to inline diagnostics in `rustc_borrowck`) - #152117 (Convert to inline diagnostics in `rustc_trait_selection`) - #152136 (Consolidate type const checks on `tcx.is_type_const`) - #152140 (Hard code the error code registry for custom drivers) - #152155 (Fix typos in riscv64a23-unknown-linux-gnu.md) - #152170 (Port `rustc_effective_visibility` to the new attribute parser) - #152182 (update compiler stable backport zulip msg) - #152184 (Port rustc_abi to the attribute parser) - #152195 (update openmp/offload builds to LLVM 22, Part 1) - #152202 (chore: clearify tidy's error message) Failed merges: - #151744 (fix refining_impl_trait suggestion with return_type_notation) - #152212 (Port some attributes to the attr parser)
Rollup merge of #151474 - nnethercote:circ-deps, r=davidtwco Minor structural improvements Some small cleanups. r? @davidtwco
Some small cleanups.
r? @davidtwco