Skip to content

Move attributes out of rustc_hir - #160336

Open
mejrs wants to merge 2 commits into
rust-lang:mainfrom
mejrs:move_attribute
Open

Move attributes out of rustc_hir#160336
mejrs wants to merge 2 commits into
rust-lang:mainfrom
mejrs:move_attribute

Conversation

@mejrs

@mejrs mejrs commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

Previous graph:

image

Graph with this pr:

image

So while it doesn't really look like much (might be nicer for pipeling or if you're editing rustc_hir), it unblocks followup work to split up this part of the crate graph further, like:

  • moving SanitizerSet to a (new?) crate below rustc_target so that rustc_target and rustc_attr_ir no longer depend on each other and can compile in parallel
  • rustc_session will only depend on rustc_hir for rustc_hir::definitions in its cstore module, there may be something there but I haven't looked in depth.

There's some work left wrt cleaning up imports everywhere, but that's for followups.

r? @JonathanBrouwer

@rustbot

rustbot commented Aug 1, 2026

Copy link
Copy Markdown
Collaborator

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.

Some changes occurred in compiler/rustc_hir/src/attrs

cc @jdonszelmann, @JonathanBrouwer

@rustbot rustbot added A-meta Area: Issues & PRs about the rust-lang/rust repository itself 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 Aug 1, 2026
@mejrs mejrs added the A-attributes Area: Attributes (`#[…]`, `#![…]`) label Aug 1, 2026
@mejrs

mejrs commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@rustbot try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 1, 2026
@rust-log-analyzer

This comment has been minimized.

@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Aug 1, 2026
@mejrs
mejrs force-pushed the move_attribute branch 2 times, most recently from 52f2993 to 0b1c8e0 Compare August 1, 2026 14:30

@fbstj fbstj Aug 1, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

should this crate have a readme?

View changes since the review

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Maybe but not in this PR, I want to keep this PR as concise as I can.

@JonathanBrouwer

Copy link
Copy Markdown
Contributor

@bors try

@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Aug 1, 2026
Move attributes out of rustc_hir
@mejrs

mejrs commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Oops

@mejrs

mejrs commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

By the way I did a perf run on the other PR as well, see https://perf.rust-lang.org/compare.html?start=29e68fe2295f8fc2feb52b8cb0b61a055842fdcf&end=5bfd1598fde1f19d34aa3199461963dcce69bb0a&stat=instructions%3Au&tab=bootstrap

But the rustc_symbol_mangling result is weird, let's see if that happens again.

@joshtriplett

Copy link
Copy Markdown
Member

@mejrs What did you use to graph the dependencies?

@mejrs

mejrs commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

@mejrs What did you use to graph the dependencies?

cargo depgraph --workspace-only --dedup-transitive-deps --root rustc-main | dot -Tpng > graph.png

Also take a look at the --timings option (https://rustc-dev-guide.rust-lang.org/profiling.html#profiling-the-compiler) - that's a good way to tell what's actually bottlenecking what.

@rust-bors

rust-bors Bot commented Aug 1, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 8ff9bde (8ff9bdec9d19be2195089ff2c4d871a9dfe437fe)
Base parent: b430378 (b430378746a835fd5240e2c7169795d7de0547e8)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (8ff9bde): comparison URL.

Overall result: no relevant changes - no action needed

Benchmarking means the PR may be perf-sensitive. Consider adding rollup=never if this change is not fit for rolling up.

@rustbot label: -S-waiting-on-perf -perf-regression

Instruction count

This perf run didn't have relevant results for this metric.

Max RSS (memory usage)

Results (primary -6.2%, secondary 0.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.8% [0.8%, 0.8%] 1
Improvements ✅
(primary)
-6.2% [-6.2%, -6.2%] 1
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) -6.2% [-6.2%, -6.2%] 1

Cycles

Results (primary 0.5%, secondary -0.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
1.4% [0.5%, 3.4%] 7
Regressions ❌
(secondary)
3.0% [0.5%, 8.5%] 4
Improvements ✅
(primary)
-1.0% [-1.4%, -0.4%] 4
Improvements ✅
(secondary)
-1.3% [-3.5%, -0.4%] 11
All ❌✅ (primary) 0.5% [-1.4%, 3.4%] 11

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 489.711s -> 487.73s (-0.40%)
Artifact size: 390.35 MiB -> 390.34 MiB (-0.00%)

@rustbot rustbot removed the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Aug 2, 2026
@joshtriplett

Copy link
Copy Markdown
Member

@mejrs wrote:

cargo depgraph --workspace-only --dedup-transitive-deps --root rustc-main | dot -Tpng > graph.png

Thanks!

Also take a look at the --timings option (https://rustc-dev-guide.rust-lang.org/profiling.html#profiling-the-compiler) - that's a good way to tell what's actually bottlenecking what.

I'm familiar; I added the support for doing ./x build compiler --timings. :)

(I just sent a PR to rustc-dev-guide to document that.)

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

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-meta Area: Issues & PRs about the rust-lang/rust repository itself 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-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.

7 participants