Skip to content

Restore remaining Cargo package environment variables#32

Closed
michaelm-openai wants to merge 1 commit into
hermeticbuild:mainfrom
michaelm-openai:codex/restore-cargo-package-environment
Closed

Restore remaining Cargo package environment variables#32
michaelm-openai wants to merge 1 commit into
hermeticbuild:mainfrom
michaelm-openai:codex/restore-cargo-package-environment

Conversation

@michaelm-openai

Copy link
Copy Markdown

Summary

  • define the remaining Cargo package environment variables for Rust targets
  • derive version components while preserving the complete version string
  • cover prerelease and build metadata behavior in the existing build environment test

Why

Cargo defines its package metadata environment variables even when optional manifest fields are absent. Rust targets should provide the same compile-time contract so code using env! and derive macros can rely on those variables consistently.

Validation

  • bazel test --nocache_test_results //test/build_env/...
  • pre-commit run buildifier --files rust/private/rustc.bzl test/build_env/BUILD.bazel
  • pre-commit run typos --files rust/private/rustc.bzl test/build_env/BUILD.bazel test/build_env/tests/custom_crate_name.rs
  • rustfmt --check test/build_env/tests/custom_crate_name.rs
  • git diff --check

Assisted-by: Codex <noreply@openai.com>
@michaelm-openai michaelm-openai marked this pull request as ready for review July 3, 2026 02:15
@dzbarsky

dzbarsky commented Jul 7, 2026

Copy link
Copy Markdown
Member

I'm going to drop the patch during next rebase instead, conceptually this will be landed, thx

@dzbarsky dzbarsky closed this Jul 7, 2026
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