Skip to content

Conversation

refi64
Copy link
Contributor

@refi64 refi64 commented Jul 24, 2025

Right now, only library targets provide metadata-related output groups. This makes sense for compilation purposes, but building the metadata is also useful for other things; namely, building only the metadata is the fastest way to get diagnostic information for your workspace like cargo check does.

This PR adds a new setting, always_enable_metadata_output_groups, that enables both the build_metadata and rustc_rmeta_output output groups for non-library targets (such as binaries and tests). That means that the presence of metadata in CrateInfo can no longer be used to determine pipelind compilation support, so a new attribute, metadata_supports_pipelining, is added for that purpose.

As an example of the performance increase, compare a bazel build on a binary w/o --output_groups=rustc_rmeta_output:

INFO: Elapsed time: 2.247s, Critical Path: 2.11s

to with it:

INFO: Elapsed time: 1.034s, Critical Path: 0.90s

@refi64 refi64 force-pushed the always_enable_metadata_output_groups branch from aaf599b to 18fbe17 Compare July 24, 2025 01:35
Right now, only library targets provide metadata-related output groups.
This makes sense for compilation purposes, but building the metadata is
also useful for other things; namely, building *only* the metadata is
the fastest way to get diagnostic information for your workspace like
`cargo check` does.

This PR adds a new setting, `always_enable_metadata_output_groups`, that
enables both the `build_metadata` and `rustc_rmeta_output` output groups
for non-library targets (such as binaries and tests). That means that
the presence of metadata in `CrateInfo` can no longer be used to
determine pipelind compilation support, so a new attribute,
`metadata_supports_pipelining`, is added for that purpose.

As an example of the performance increase, compare a `bazel build` on
a binary w/o `--output_groups=rustc_rmeta_output`:

```
INFO: Elapsed time: 2.247s, Critical Path: 2.11s
```

to with it:

```
INFO: Elapsed time: 1.034s, Critical Path: 0.90s
```
@refi64 refi64 force-pushed the always_enable_metadata_output_groups branch from 18fbe17 to 2e2cd64 Compare July 24, 2025 01:48
Copy link
Collaborator

@illicitonion illicitonion left a comment

Choose a reason for hiding this comment

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

Thanks!

@illicitonion illicitonion added this pull request to the merge queue Aug 25, 2025
Merged via the queue into bazelbuild:main with commit e6fbf6e Aug 25, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants