Skip to content

Minor structural improvements#151474

Merged
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
nnethercote:circ-deps
Feb 6, 2026
Merged

Minor structural improvements#151474
rust-bors[bot] merged 3 commits intorust-lang:mainfrom
nnethercote:circ-deps

Conversation

@nnethercote
Copy link
Contributor

Some small cleanups.

r? @davidtwco

@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. labels Jan 22, 2026
@nnethercote
Copy link
Contributor Author

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.

@rust-bors

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.
@rustbot
Copy link
Collaborator

rustbot commented Jan 27, 2026

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.

@davidtwco
Copy link
Member

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Feb 5, 2026

📌 Commit b33fdb2 has been approved by davidtwco

It is now in the queue for this repository.

@rust-bors rust-bors bot 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 Feb 5, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 5, 2026
Minor structural improvements

Some small cleanups.

r? @davidtwco
rust-bors bot pushed a commit that referenced this pull request Feb 5, 2026
…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)
rust-bors bot pushed a commit that referenced this pull request Feb 5, 2026
…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)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 5, 2026
Minor structural improvements

Some small cleanups.

r? @davidtwco
rust-bors bot pushed a commit that referenced this pull request Feb 5, 2026
…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)
rust-bors bot pushed a commit that referenced this pull request Feb 5, 2026
…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)
rust-bors bot pushed a commit that referenced this pull request Feb 5, 2026
…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)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 6, 2026
Minor structural improvements

Some small cleanups.

r? @davidtwco
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Feb 6, 2026
Minor structural improvements

Some small cleanups.

r? @davidtwco
rust-bors bot pushed a commit that referenced this pull request Feb 6, 2026
…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)
@rust-bors rust-bors bot merged commit 3fb5265 into rust-lang:main Feb 6, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Feb 6, 2026
rust-timer added a commit that referenced this pull request Feb 6, 2026
Rollup merge of #151474 - nnethercote:circ-deps, r=davidtwco

Minor structural improvements

Some small cleanups.

r? @davidtwco
@nnethercote nnethercote deleted the circ-deps branch February 7, 2026 03:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants