Skip to content

Lint derive-generated code in CI - #3724

Open
joshlf wants to merge 28 commits into
mainfrom
generated-code-clippy-policy
Open

joshlf wants to merge 28 commits into
mainfrom
generated-code-clippy-policy

Conversation

@joshlf

@joshlf joshlf commented Sep 25, 2026 •

Copy link
Copy Markdown
Member

Follow up on #3721 and #3722 by making Clippy validation of derive-generated code explicit.

Zerocopy CI now compiles zerocopy-derive integration tests in an internal mode that denies clippy::all, clippy::pedantic, and clippy::nursery on generated-only scopes. We intentionally do not enable clippy::restriction wholesale because that group is policy-specific and contains mutually incompatible lints.

This group-level lint mode is CI-only and is not emitted in normal downstream expansions. Existing targeted generated-code allowances remain in place where needed.

The #3721 regression integration test continues to deny clippy::derive_partial_eq_without_eq, checking downstream behavior under the existing lint policy without claiming compatibility with forbid(...).

The existing nightly cargo clippy --tests matrix enables internal lint mode for zerocopy-derive, covering all integration-test targets selected by Cargo. A separate nightly x86_64 check compiles the #3721 fixture in normal downstream mode.

Caller-authored invariant expressions retain the caller's lint policy; generated-code lint attributes remain outside those mixed scopes. Two nursery lints about duplicate bounds are excluded only from internal generated-code checking because they diagnose caller-authored bounds copied verbatim into generated impls; the caller's own declaration remains subject to the caller's lint policy.

Authored by an AI agent acting on joshlf's behalf.

@joshlf
joshlf marked this pull request as ready for review September 25, 2026 17:51
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 25, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-25T18:19:36.440315Z 6628b3d Manual request
🔒 Security Review ✅ Completed 2026-09-25T18:19:50.843924Z 6628b3d Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov-commenter

codecov-commenter commented Sep 25, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.64%. Comparing base (41f5b37) to head (a8142cb).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3724   +/-   ##
=======================================
  Coverage   92.64%   92.64%           
=======================================
  Files          20       20           
  Lines        6429     6429           
=======================================
  Hits         5956     5956           
  Misses        473      473           

☔ View full report in Codecov by Harness.
📢 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bdbe9811f0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread zerocopy/zerocopy-derive/src/util.rs Outdated
Comment on lines +938 to +942
clippy::all,
clippy::cargo,
clippy::pedantic,
clippy::nursery,
clippy::restriction,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid allowing entire Clippy groups in generated code

When a downstream crate runs Clippy and forbids any lint contained in one of these groups—for example, #![forbid(clippy::needless_borrow)]—the generated #[allow(clippy::all)] attempts to lower that forbidden lint and produces E0453 at every derive expansion; the same applies to members of the cargo, pedantic, nursery, and restriction groups. Consequently, strict consumers that previously compiled can no longer use any derive even when the expansion does not trigger their forbidden lint. Keep emitted suppressions targeted to concrete generated-code violations, or make those expansions lint-clean, rather than lowering blanket groups.

AGENTS.md reference: zerocopy/AGENTS.md:L49-L50

Useful? React with 👍 / 👎.

joshlf commented Sep 25, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Swish!

Reviewed commit: 6628b3d2c9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 6628b3d2c9

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@joshlf
joshlf requested a review from jswrenn September 25, 2026 18:33
Comment thread zerocopy/zerocopy-derive/src/util.rs Outdated
Comment thread zerocopy/zerocopy-derive/tests/clippy.rs Outdated
Restore the targeted generated-code Clippy allowance and keep the #3721 regression test at deny rather than forbid.

This branch has not been deployed

No deployments
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