Skip to content

[cargo-zerocopy] Pass --cfg __ZEROCOPY_INTERNAL_USE_ONL_TOOLCHAIN=...#2983

Merged
joshlf merged 1 commit intomainfrom
G9c6fe23f1983e0f1a3d30e1db70e020595260e23
Feb 4, 2026
Merged

[cargo-zerocopy] Pass --cfg __ZEROCOPY_INTERNAL_USE_ONL_TOOLCHAIN=...#2983
joshlf merged 1 commit intomainfrom
G9c6fe23f1983e0f1a3d30e1db70e020595260e23

Conversation

@joshlf
Copy link
Copy Markdown
Member

@joshlf joshlf commented Feb 4, 2026

This allows testing code to detect the current named toolchain. Unlike
the rustversion crate, it won't require us to update use sites when we
update pinned toolchain versions.


Latest Update: v3 — Compare vs v2

📚 Full Patch History

Links show the diff between the row version and the column version.

Version v2 v1 Base
v3 vs v2 vs v1 vs Base
v2 vs v1 vs Base
v1 vs Base
⬇️ Download this PR

Branch

git fetch origin refs/heads/G9c6fe23f1983e0f1a3d30e1db70e020595260e23 && git checkout -b pr-G9c6fe23f1983e0f1a3d30e1db70e020595260e23 FETCH_HEAD

Checkout

git fetch origin refs/heads/G9c6fe23f1983e0f1a3d30e1db70e020595260e23 && git checkout FETCH_HEAD

Cherry Pick

git fetch origin refs/heads/G9c6fe23f1983e0f1a3d30e1db70e020595260e23 && git cherry-pick FETCH_HEAD

Pull

git pull origin refs/heads/G9c6fe23f1983e0f1a3d30e1db70e020595260e23

Stacked PRs enabled by GHerrit.

This allows testing code to detect the current named toolchain. Unlike
the `rustversion` crate, it won't require us to update use sites when we
update pinned toolchain versions.

gherrit-pr-id: G9c6fe23f1983e0f1a3d30e1db70e020595260e23
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @joshlf, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances the cargo-zerocopy build process by introducing a new configuration flag that exposes the active Rust toolchain's name. This modification allows internal testing infrastructure to reliably detect the specific toolchain being used, offering a more resilient and less maintenance-intensive approach than previous methods.

Highlights

  • Toolchain Detection: A new cfg flag, __ZEROCOPY_INTERNAL_USE_ONLY_TOOLCHAIN, is now passed during the build process of cargo-zerocopy.
  • Dynamic Toolchain Name: This flag dynamically includes the name of the currently active Rust toolchain, allowing internal testing code to identify it.
  • Improved Maintainability: This change provides a more stable method for toolchain detection compared to relying on the rustversion crate, which would require updates with pinned toolchain versions.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • tools/cargo-zerocopy/src/main.rs
    • Added a line to append a cfg flag containing the current toolchain's name to the rustflags.
Activity
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@joshlf joshlf requested a review from jswrenn February 4, 2026 15:55
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds a --cfg flag to pass the current toolchain name to rustc, which is useful for conditional compilation. The change is correct and achieves its goal. I've included one suggestion to refactor the string construction for the flags, which improves readability and can be slightly more efficient.

Comment thread tools/cargo-zerocopy/src/main.rs
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.02%. Comparing base (78088c4) to head (9e964fb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2983   +/-   ##
=======================================
  Coverage   92.02%   92.02%           
=======================================
  Files          19       19           
  Lines        6029     6029           
=======================================
  Hits         5548     5548           
  Misses        481      481           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@joshlf joshlf added this pull request to the merge queue Feb 4, 2026
Merged via the queue into main with commit e36bfa1 Feb 4, 2026
104 checks passed
@joshlf joshlf deleted the G9c6fe23f1983e0f1a3d30e1db70e020595260e23 branch February 4, 2026 17:51
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.

3 participants