Skip to content

[test] Move impl_or_verify! tests to doctests#2988

Open
joshlf wants to merge 1 commit intoG413a86267ff4384a9806de9a784407f1f5be96aafrom
G793f61a136b912fbd5ee4315cdea7cf3cf3cf8fb
Open

[test] Move impl_or_verify! tests to doctests#2988
joshlf wants to merge 1 commit intoG413a86267ff4384a9806de9a784407f1f5be96aafrom
G793f61a136b912fbd5ee4315cdea7cf3cf3cf8fb

Conversation

@joshlf
Copy link
Member

@joshlf joshlf commented Feb 5, 2026

They require a lot of fragile machinery as UI tests, and are much
simpler as doc tests.


Latest Update: v2 — Compare vs v1

📚 Full Patch History

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

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

Branch

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

Checkout

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

Cherry Pick

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

Pull

git pull origin refs/heads/G793f61a136b912fbd5ee4315cdea7cf3cf3cf8fb

Stacked PRs enabled by GHerrit.

@gemini-code-assist
Copy link
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 streamlines the testing infrastructure for the impl_or_verify! macro by transitioning its validation tests from traditional UI tests to Rust's built-in doctest system. This move significantly reduces the complexity and fragility associated with UI tests, resulting in a more robust and maintainable test suite.

Highlights

  • Test Refactoring: The tests for the impl_or_verify! macro have been migrated from UI tests to Rust's built-in doctests.
  • Simplified Testing: This change eliminates the need for complex UI test machinery, making the tests simpler, less fragile, and easier to maintain.
  • Macro Export for Doctests: The impl_or_verify! macro is now conditionally exported using #[cfg_attr(__ZEROCOPY_INTERNAL_USE_ONLY_DEV_MODE, macro_export)] to allow its use within doctests.
  • Removal of UI Test Files: Several UI test files and their corresponding stderr outputs, which previously handled invalid-impls scenarios, have been removed as their functionality is now covered by doctests.

🧠 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
  • src/doctests.rs
    • Added a new compile_fail doctest, InvalidImplOrVerify, to validate the impl_or_verify! macro's behavior for invalid trait implementations.
  • src/util/macros.rs
    • Applied #[cfg_attr(__ZEROCOPY_INTERNAL_USE_ONLY_DEV_MODE, macro_export)] to the impl_or_verify! macro, making it accessible for internal doctesting purposes.
    • Made a minor textual correction in a doc comment related to the impl_or_verify! macro's usage restrictions.
  • tests/trybuild.rs
    • Removed the ui_invalid_impls test function, which previously managed the UI tests for invalid macro implementations.
  • tests/ui-msrv/invalid-impls/invalid-impls.rs
    • Removed the UI test source file.
  • tests/ui-msrv/invalid-impls/invalid-impls.stderr
    • Removed the expected error output file for the UI test.
  • tests/ui-nightly/invalid-impls/invalid-impls.rs
    • Removed the UI test source file.
  • tests/ui-nightly/invalid-impls/invalid-impls.stderr
    • Removed the expected error output file for the UI test.
  • tests/ui-stable/invalid-impls/invalid-impls.rs
    • Removed the UI test source file.
  • tests/ui-stable/invalid-impls/invalid-impls.stderr
    • Removed the expected error output file for the UI test.
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 5, 2026 02:16
Copy link
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 is a nice simplification of the test suite. It moves the tests for the impl_or_verify! macro from fragile trybuild UI tests into much simpler doctests. This refactoring correctly preserves the test's intent—ensuring that the macro fails to compile when trait bounds are missing—while significantly improving maintainability by removing the need for toolchain-specific test files. The changes are well-executed and I have no concerns.

@codecov-commenter
Copy link

codecov-commenter commented Feb 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.87%. Comparing base (5ed532f) to head (e5c4b11).

Additional details and impacted files
@@                            Coverage Diff                             @@
##           G413a86267ff4384a9806de9a784407f1f5be96aa    #2988   +/-   ##
==========================================================================
  Coverage                                      91.87%   91.87%           
==========================================================================
  Files                                             20       20           
  Lines                                           6057     6057           
==========================================================================
  Hits                                            5565     5565           
  Misses                                           492      492           

☔ 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.

They require a lot of fragile machinery as UI tests, and are much
simpler as doc tests.

gherrit-pr-id: G793f61a136b912fbd5ee4315cdea7cf3cf3cf8fb
@joshlf joshlf force-pushed the G793f61a136b912fbd5ee4315cdea7cf3cf3cf8fb branch from 7e5f696 to e5c4b11 Compare February 5, 2026 03:09
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