Skip to content

fix(rust): mark crate_universe extension as dev_dependency [arguable] - #28274

Closed
rdesgroppes wants to merge 1 commit into
protocolbuffers:mainfrom
rdesgroppes:fix-crate-universe-dev-dependency
Closed

rdesgroppes wants to merge 1 commit into
protocolbuffers:mainfrom
rdesgroppes:fix-crate-universe-dev-dependency

Conversation

@rdesgroppes

@rdesgroppes rdesgroppes commented Jun 30, 2026 •

Copy link
Copy Markdown

Fixes #28224.

rules_rust 0.71.1 (bazelbuild/rules_rust#4109) rejects any non-root crate_universe extension call without a lockfile.
A Bazel build depending on protobuf and using rules_rust >= 0.71.1 therefore fails to resolve:

crate_universe extension call `crates` is in a non-root module but has no lockfile. [...]

dev_dependency = True makes Bazel skip the extension entirely when protobuf is not the root module, sidestepping the lockfile requirement without committing large generated files.

This is only viable for consumers that do not build protobuf's own Rust targets (those depend on @crate_index which becomes unavailable).

See the sibling PR #28230 for an alternative that works unconditionally.

Fixes protocolbuffers#28224.

`rules_rust` 0.71.1 (bazelbuild/rules_rust#4109) rejects any non-root
`crate_universe` extension call without a `lockfile`.
A Bazel build depending on `protobuf` and using `rules_rust` >= 0.71.1
therefore fails to resolve:
```
crate_universe extension call `crates` is in a non-root module but
has no lockfile. [...]
```

`dev_dependency = True` makes Bazel skip the extension entirely when
`protobuf` is not the root module, sidestepping the lockfile
requirement without committing large generated files.

This is viable for consumers that do not build protobuf's own Rust
targets (those depend on `@crate_index` which becomes unavailable).
See the sibling branch `fix-crate-universe-lockfile` for an alternative
that works unconditionally.
@rdesgroppes
rdesgroppes marked this pull request as draft June 30, 2026 07:51
@rdesgroppes rdesgroppes changed the title fix(rust): mark crate_universe extension as dev_dependency fix(rust): mark crate_universe extension as dev_dependency [arguable] Jun 30, 2026
@rdesgroppes
rdesgroppes deleted the fix-crate-universe-dev-dependency branch August 24, 2026 06:27
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.

Bazel: "crates is in a non-root module but has no lockfile" since rules_rust 0.71.1

1 participant