Skip to content

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants