Skip to content

Invert dependency between rustc_errors and rustc_abi.#154449

Merged
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
nnethercote:rustc_errors-dep-rustc_abi
Apr 10, 2026
Merged

Invert dependency between rustc_errors and rustc_abi.#154449
rust-bors[bot] merged 2 commits intorust-lang:mainfrom
nnethercote:rustc_errors-dep-rustc_abi

Conversation

@nnethercote
Copy link
Copy Markdown
Contributor

@nnethercote nnethercote commented Mar 27, 2026

Currently, rustc_errors depends on rustc_abi, which depends on rustc_error_messages. This is a bit odd.

rustc_errors depends on rustc_abi for a single reason: rustc_abi defines a type TargetDataLayoutErrors and rustc_errors impls Diagnostic for that type.

We can get a more natural relationship by inverting the dependency, moving the Diagnostic trait upstream. Then rustc_abi defines TargetDataLayoutErrors and also impls Diagnostic for it. rustc_errors is already pretty far upstream in the crate graph, it doesn't hurt to push it a little further because errors are a very low-level concept.

r? @davidtwco

@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 27, 2026

These commits modify compiler targets.
(See the Target Tier Policy.)

rustc_error_messages was changed

cc @TaKO8Ki

These commits modify the Cargo.lock file. Unintentional changes to Cargo.lock can be introduced when switching branches and rebasing PRs.

If this was unintentional then you should revert the changes before this PR is merged.
Otherwise, you can ignore this comment.

@rustbot rustbot added A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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 Mar 27, 2026
@rust-log-analyzer

This comment has been minimized.

@nnethercote nnethercote force-pushed the rustc_errors-dep-rustc_abi branch from 650aac9 to 2f9b158 Compare March 27, 2026 03:36
@rust-log-analyzer

This comment has been minimized.

@nnethercote nnethercote force-pushed the rustc_errors-dep-rustc_abi branch from 2f9b158 to 4b44bf0 Compare March 27, 2026 03:42
@nnethercote
Copy link
Copy Markdown
Contributor Author

Partial crate graph, before:
image

And after:
image

I doubt this has any effect on bootstrap times because the relevant crates are quite small.

Currently, `rustc_errors` depends on `rustc_abi`, which depends on
`rustc_error_messages`. This is a bit odd.

`rustc_errors` depends on `rustc_abi` for a single reason: `rustc_abi`
defines a type `TargetDataLayoutErrors` and `rustc_errors` impls
`Diagnostic` for that type.

We can get a more natural relationship by inverting the dependency,
moving the `Diagnostic` trait upstream. Then `rustc_abi` defines
`TargetDataLayoutErrors` and also impls `Diagnostic` for it.
`rustc_errors` is already pretty far upstream in the crate graph, it
doesn't hurt to push it a little further because errors are a very
low-level concept.
Error enum names should not be plural. Even though there are multiple
possible errors, each instance of an error enum describes a single
error. There are dozens of singular error enum names, and only two
plural error enum names. This commit makes them both singular.
@nnethercote nnethercote force-pushed the rustc_errors-dep-rustc_abi branch from 4b44bf0 to 0db4e3a Compare March 30, 2026 03:15
@rustbot
Copy link
Copy Markdown
Collaborator

rustbot commented Mar 30, 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
Copy Markdown
Member

@bors r+ rollup

@rust-bors
Copy link
Copy Markdown
Contributor

rust-bors bot commented Apr 10, 2026

📌 Commit 0db4e3a 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 Apr 10, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Apr 10, 2026
…_abi, r=davidtwco

Invert dependency between `rustc_errors` and `rustc_abi`.

Currently, `rustc_errors` depends on `rustc_abi`, which depends on `rustc_error_messages`. This is a bit odd.

`rustc_errors` depends on `rustc_abi` for a single reason: `rustc_abi` defines a type `TargetDataLayoutErrors` and `rustc_errors` impls `Diagnostic` for that type.

We can get a more natural relationship by inverting the dependency, moving the `Diagnostic` trait upstream. Then `rustc_abi` defines `TargetDataLayoutErrors` and also impls `Diagnostic` for it. `rustc_errors` is already pretty far upstream in the crate graph, it doesn't hurt to push it a little further because errors are a very low-level concept.

r? @davidtwco
rust-bors bot pushed a commit that referenced this pull request Apr 10, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - #152901 (Introduce a `#[diagnostic::on_unknown]` attribute)
 - #155078 (Reject dangling attributes in where clauses)
 - #154449 (Invert dependency between `rustc_errors` and `rustc_abi`.)
 - #154646 (Add suggestion to `.to_owned()` used on `Cow` when borrowing)
 - #154993 (compiletest: pass -Zunstable-options for unpretty and no-codegen paths)
 - #155097 (Make `rustc_attr_parsing::SharedContext::emit_lint` take a `MultiSpan` instead of a `Span`)
@rust-bors rust-bors bot merged commit 197fb1b into rust-lang:main Apr 10, 2026
11 checks passed
@rustbot rustbot added this to the 1.96.0 milestone Apr 10, 2026
rust-timer added a commit that referenced this pull request Apr 10, 2026
Rollup merge of #154449 - nnethercote:rustc_errors-dep-rustc_abi, r=davidtwco

Invert dependency between `rustc_errors` and `rustc_abi`.

Currently, `rustc_errors` depends on `rustc_abi`, which depends on `rustc_error_messages`. This is a bit odd.

`rustc_errors` depends on `rustc_abi` for a single reason: `rustc_abi` defines a type `TargetDataLayoutErrors` and `rustc_errors` impls `Diagnostic` for that type.

We can get a more natural relationship by inverting the dependency, moving the `Diagnostic` trait upstream. Then `rustc_abi` defines `TargetDataLayoutErrors` and also impls `Diagnostic` for it. `rustc_errors` is already pretty far upstream in the crate graph, it doesn't hurt to push it a little further because errors are a very low-level concept.

r? @davidtwco
@nnethercote nnethercote deleted the rustc_errors-dep-rustc_abi branch April 12, 2026 21:53
github-actions bot pushed a commit to rust-lang/rustc-dev-guide that referenced this pull request Apr 13, 2026
…uwer

Rollup of 6 pull requests

Successful merges:

 - rust-lang/rust#152901 (Introduce a `#[diagnostic::on_unknown]` attribute)
 - rust-lang/rust#155078 (Reject dangling attributes in where clauses)
 - rust-lang/rust#154449 (Invert dependency between `rustc_errors` and `rustc_abi`.)
 - rust-lang/rust#154646 (Add suggestion to `.to_owned()` used on `Cow` when borrowing)
 - rust-lang/rust#154993 (compiletest: pass -Zunstable-options for unpretty and no-codegen paths)
 - rust-lang/rust#155097 (Make `rustc_attr_parsing::SharedContext::emit_lint` take a `MultiSpan` instead of a `Span`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic 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.

4 participants