Skip to content

Handle build scripts better in -Zmacro-stats output. #143228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 1, 2025

Conversation

nnethercote
Copy link
Contributor

Currently all build scripts are listed as build_script_build in the stats header. This commit uses CARGO_PKG_NAME to improve that.

I tried it on Bevy, it works well, giving output like this on the build script:

MACRO EXPANSION STATS: serde build script

and this on the crate itself:

MACRO EXPANSION STATS: serde

r? @Kobzol

Currently all build scripts are listed as `build_script_build` in the
stats header. This commit uses `CARGO_PKG_NAME` to improve that.

I tried it on Bevy, it works well, giving output like this on the build
script:
```
MACRO EXPANSION STATS: serde build script
```
and this on the crate itself:
```
MACRO EXPANSION STATS: serde
```
@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 Jun 30, 2025
@nnethercote
Copy link
Contributor Author

@bors rollup

@bjorn3
Copy link
Member

bjorn3 commented Jun 30, 2025

Maybe add a (build script) suffix?

@nnethercote
Copy link
Contributor Author

I used $CRATE build script because that's what cargo --timings uses in its output.

@bjorn3
Copy link
Member

bjorn3 commented Jun 30, 2025

Missed that you already added a suffix. 🤦

@Kobzol
Copy link
Member

Kobzol commented Jun 30, 2025

@bors r+

@bors
Copy link
Collaborator

bors commented Jun 30, 2025

📌 Commit c3c995a has been approved by Kobzol

It is now in the queue for this repository.

@bors bors 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 Jun 30, 2025
bors added a commit that referenced this pull request Jun 30, 2025
Rollup of 9 pull requests

Successful merges:

 - #143019 (Ensure -V --verbose processes both codegen_backend and codegen-backend)
 - #143140 (give Pointer::into_parts a more scary name and offer a safer alternative)
 - #143175 (Make combining LLD with external LLVM config a hard error)
 - #143180 (Use `tracing-forest` instead of `tracing-tree` for bootstrap tracing)
 - #143223 (Improve macro stats printing)
 - #143228 (Handle build scripts better in `-Zmacro-stats` output.)
 - #143229 ([COMPILETEST-UNTANGLE 1/N] Move some some early config checks to the lib and move the compiletest binary)
 - #143246 (Subtree update of `rust-analyzer`)
 - #143248 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit f2231d5 into rust-lang:master Jul 1, 2025
10 checks passed
@rustbot rustbot added this to the 1.90.0 milestone Jul 1, 2025
rust-timer added a commit that referenced this pull request Jul 1, 2025
Rollup merge of #143228 - nnethercote:macro-stats-build-scripts, r=Kobzol

Handle build scripts better in `-Zmacro-stats` output.

Currently all build scripts are listed as `build_script_build` in the stats header. This commit uses `CARGO_PKG_NAME` to improve that.

I tried it on Bevy, it works well, giving output like this on the build script:
```
MACRO EXPANSION STATS: serde build script
```
and this on the crate itself:
```
MACRO EXPANSION STATS: serde
```

r? `@Kobzol`
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jul 1, 2025
Rollup of 9 pull requests

Successful merges:

 - rust-lang/rust#143019 (Ensure -V --verbose processes both codegen_backend and codegen-backend)
 - rust-lang/rust#143140 (give Pointer::into_parts a more scary name and offer a safer alternative)
 - rust-lang/rust#143175 (Make combining LLD with external LLVM config a hard error)
 - rust-lang/rust#143180 (Use `tracing-forest` instead of `tracing-tree` for bootstrap tracing)
 - rust-lang/rust#143223 (Improve macro stats printing)
 - rust-lang/rust#143228 (Handle build scripts better in `-Zmacro-stats` output.)
 - rust-lang/rust#143229 ([COMPILETEST-UNTANGLE 1/N] Move some some early config checks to the lib and move the compiletest binary)
 - rust-lang/rust#143246 (Subtree update of `rust-analyzer`)
 - rust-lang/rust#143248 (Update books)

r? `@ghost`
`@rustbot` modify labels: rollup
@nnethercote nnethercote deleted the macro-stats-build-scripts branch July 1, 2025 08:20
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.

5 participants