Skip to content

move some attribute related structs out of rustc_attr_ir - #161259

Open
mejrs wants to merge 14 commits into
rust-lang:mainfrom
mejrs:attr_structures
Open

move some attribute related structs out of rustc_attr_ir#161259
mejrs wants to merge 14 commits into
rust-lang:mainfrom
mejrs:attr_structures

Conversation

@mejrs

@mejrs mejrs commented Aug 17, 2026

Copy link
Copy Markdown
Member

This changes it so that

  • rustc_session no longer depends on rustc_attr_ir
  • rustc_attr_ir no longer depends on rustc_target (which is a fairly sizeable crate)
  • rustc_attr_ir and rustc_target can compile in parallel

Previous graph:
image

Graph with this PR:
image

r? @JonathanBrouwer

@rustbot

rustbot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred in compiler/rustc_passes/src/check_attr.rs

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred in compiler/rustc_attr_ir

cc @jdonszelmann, @JonathanBrouwer

Some changes occurred to the CTFE machinery

cc @RalfJung, @oli-obk, @lcnr

clippy is developed in its own repository. If possible, consider making this change to rust-lang/rust-clippy instead.

cc @rust-lang/clippy

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.

rustc_codegen_cranelift is developed in its own repository. If possible, consider making this change to rust-lang/rustc_codegen_cranelift instead.

cc @bjorn3

rustc_error_messages was changed

cc @TaKO8Ki

Some changes occurred to the CTFE / Miri interpreter

cc @rust-lang/miri

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. labels Aug 17, 2026
@rust-log-analyzer

This comment has been minimized.

@rustbot

rustbot commented Aug 17, 2026

Copy link
Copy Markdown
Collaborator

miri is developed in its own repository. If the Miri part of this change can be broken out, consider making this change to rust-lang/miri instead. However, if Miri needs adjusting for rustc changes, just ignore this message.

cc @rust-lang/miri

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rustbot

rustbot commented Aug 21, 2026

Copy link
Copy Markdown
Collaborator

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.

@JonathanBrouwer

JonathanBrouwer commented Aug 21, 2026

Copy link
Copy Markdown
Member

^ Rebased, rustc_session is now also unused in clippy_lints

@@ -0,0 +1,15 @@
//! Basic structs that end up being used in attributes for one reason or another,

@JonathanBrouwer JonathanBrouwer Aug 21, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change is great, the only thing I'm iffy about is the name rustc_structures. The name is accurate because it's basically a lot of structs that don't have anything in common stuffed into a crate, but I'm also not sure how to feel about this concept.

I can't think of a better name and I don't want to start a bikeshedding session, so let's merge this if it improves bootstrap times, I'll do some measurements locally

View changes since the review

@JonathanBrouwer

Copy link
Copy Markdown
Member

On my pc running rm -r build/x86_64-unknown-linux-gnu/stage1-rustc; ./x check compiler/rustc_middle, average of 5 measurements:

  • before this 14.1s
  • after this 13.4s

@JonathanBrouwer

Copy link
Copy Markdown
Member

@bors r+ p=1 note=bitrotty

@rust-bors

rust-bors Bot commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

📌 Commit cf98f58 has been approved by JonathanBrouwer

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 Aug 21, 2026
@JonathanBrouwer JonathanBrouwer changed the title move some attribute related structs out ot rustc_attr_ir move some attribute related structs out of rustc_attr_ir Aug 21, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Aug 21, 2026
…rouwer

move some attribute related structs out of rustc_attr_ir

This changes it so that

- rustc_session no longer depends on rustc_attr_ir
- rustc_attr_ir no longer depends on rustc_target (which is a fairly sizeable crate)
- rustc_attr_ir and rustc_target can compile in parallel

Previous graph:
<img width="985" height="512" alt="image" src="https://github.com/user-attachments/assets/cbde2414-043e-45f2-88a2-f77a5c9df60c" />

Graph with this PR:
<img width="1248" height="474" alt="image" src="https://github.com/user-attachments/assets/e0e13794-b17b-4337-8768-f0191cb1c0e6" />

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) 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-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc 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